subtract.hpp
1 //*****************************************************************************
2 // Copyright 2017-2020 Intel Corporation
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //*****************************************************************************
16 
17 #pragma once
18 
19 #include "ngraph/op/util/binary_elementwise_arithmetic.hpp"
20 
21 namespace ngraph
22 {
23  namespace op
24  {
25  namespace v0
26  {
27  /// \brief Elementwise subtraction operation.
28  class NGRAPH_DEPRECATED(
29  "This operation is deprecated and will be removed soon. "
30  "Use v1::Subtract instead of it.") NGRAPH_API Subtract
31  : public util::BinaryElementwiseArithmetic
32  {
33  NGRAPH_SUPPRESS_DEPRECATED_START
34  public:
35  static constexpr NodeTypeInfo type_info{"Subtract", 0};
36  const NodeTypeInfo& get_type_info() const override { return type_info; }
37  Subtract()
38  : util::BinaryElementwiseArithmetic(AutoBroadcastSpec::NONE)
39  {
40  }
41 
42  /// \brief Constructs a subtraction operation.
43  ///
44  /// \param arg0 Node that produces the first input tensor.
45  /// \param arg1 Node that produces the second input tensor.
46  /// \param auto_broadcast Auto broadcast specification
47  Subtract(const Output<Node>& arg0,
48  const Output<Node>& arg1,
49  const AutoBroadcastSpec& auto_broadcast = AutoBroadcastSpec());
50 
51  virtual std::shared_ptr<Node>
52  clone_with_new_inputs(const OutputVector& new_args) const override;
53 
54  bool evaluate(const HostTensorVector& outputs,
55  const HostTensorVector& inputs) const override;
56  NGRAPH_SUPPRESS_DEPRECATED_END
57  };
58 
59  } // namespace v0
60 
61  namespace v1
62  {
63  /// \brief Elementwise subtraction operation.
64  class NGRAPH_API Subtract : public util::BinaryElementwiseArithmetic
65  {
66  public:
67  NGRAPH_RTTI_DECLARATION;
68 
69  Subtract()
70  : util::BinaryElementwiseArithmetic(AutoBroadcastSpec::NUMPY)
71  {
72  }
73 
74  /// \brief Constructs a subtraction operation.
75  ///
76  /// \param arg0 Node that produces the first input tensor.
77  /// \param arg1 Node that produces the second input tensor.
78  /// \param auto_broadcast Auto broadcast specification
79  Subtract(const Output<Node>& arg0,
80  const Output<Node>& arg1,
81  const AutoBroadcastSpec& auto_broadcast =
82  AutoBroadcastSpec(AutoBroadcastType::NUMPY));
83 
84  virtual std::shared_ptr<Node>
85  clone_with_new_inputs(const OutputVector& new_args) const override;
86  bool evaluate(const HostTensorVector& outputs,
87  const HostTensorVector& inputs) const override;
88  };
89  } // namespace v1
90 
91  NGRAPH_SUPPRESS_DEPRECATED_START
92  using v0::Subtract;
93  NGRAPH_SUPPRESS_DEPRECATED_END
94  } // namespace op
95 
96  NGRAPH_DEPRECATED("This operator was deprecated and will be removed with v0 operation.")
97  NGRAPH_API
98  std::shared_ptr<ngraph::Node> operator-(const Output<ngraph::Node> arg0,
99  const Output<ngraph::Node> arg1);
100 } // namespace ngraph
ngraph::op::v1::Subtract::Subtract
Subtract(const Output< Node > &arg0, const Output< Node > &arg1, const AutoBroadcastSpec &auto_broadcast=AutoBroadcastSpec(AutoBroadcastType::NUMPY))
Constructs a subtraction operation.
ngraph::op::AutoBroadcastSpec
Implicit broadcast specification.
Definition: attr_types.hpp:321
ngraph::op::v1::Subtract
Elementwise subtraction operation.
Definition: subtract.hpp:65
ngraph
The Intel nGraph C++ API.
Definition: attribute_adapter.hpp:28
ngraph::Node
Definition: node.hpp:131
ngraph::op::util::BinaryElementwiseArithmetic
Abstract base class for elementwise binary arithmetic operations, i.e., operations where the same sca...
Definition: binary_elementwise_arithmetic.hpp:55