add.hpp
1 // Copyright (C) 2018-2021 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
3 //
4 
5 #pragma once
6 
7 #include <memory>
8 
9 #include "ngraph/op/util/binary_elementwise_arithmetic.hpp"
10 
11 namespace ngraph
12 {
13  namespace op
14  {
15  namespace v1
16  {
17  /// \brief Elementwise addition operation.
18  ///
19  class NGRAPH_API Add : public util::BinaryElementwiseArithmetic
20  {
21  public:
22  NGRAPH_RTTI_DECLARATION;
23 
24  /// \brief Constructs an uninitialized addition operation
25  Add()
26  : util::BinaryElementwiseArithmetic(AutoBroadcastSpec::NUMPY)
27  {
28  }
29 
30  /// \brief Constructs an addition operation.
31  ///
32  /// \param arg0 Output that produces the first input tensor.<br>
33  /// `[d0, ...]`
34  /// \param arg1 Output that produces the second input tensor.<br>
35  /// `[d0, ...]`
36  /// \param auto_broadcast Auto broadcast specification. Default is Numpy-style
37  /// implicit broadcasting.
38  ///
39  /// Output `[d0, ...]`
40  ///
41  Add(const Output<Node>& arg0,
42  const Output<Node>& arg1,
43  const AutoBroadcastSpec& auto_broadcast =
44  AutoBroadcastSpec(AutoBroadcastType::NUMPY));
45 
46  std::shared_ptr<Node>
47  clone_with_new_inputs(const OutputVector& new_args) const override;
48 
49  bool visit_attributes(AttributeVisitor& visitor) override;
50 
51  size_t get_version() const override { return 1; }
52  bool evaluate(const HostTensorVector& outputs,
53  const HostTensorVector& inputs) const override;
54  bool has_evaluate() const override;
55  };
56  } // namespace v1
57  } // namespace op
58 } // namespace ngraph
Visits the attributes of a node, primarily for serialization-like tasks.
Definition: attribute_visitor.hpp:59
A handle for one of a node's outputs.
Definition: node_output.hpp:33
Abstract base class for elementwise binary arithmetic operations, i.e., operations where the same sca...
Definition: binary_elementwise_arithmetic.hpp:43
Elementwise addition operation.
Definition: add.hpp:20
Add(const Output< Node > &arg0, const Output< Node > &arg1, const AutoBroadcastSpec &auto_broadcast=AutoBroadcastSpec(AutoBroadcastType::NUMPY))
Constructs an addition operation.
Add()
Constructs an uninitialized addition operation.
Definition: add.hpp:25
bool has_evaluate() const override
Allows to get information about availability of evaluate method for the current operation.
size_t get_version() const override
Definition: add.hpp:51
bool evaluate(const HostTensorVector &outputs, const HostTensorVector &inputs) const override
Evaluates the op on input_values putting results in output_values.
The Intel nGraph C++ API.
Definition: attribute_adapter.hpp:16
Implicit broadcast specification.
Definition: attr_types.hpp:311