Deprecate nGraph v0 ops and builders (#1856)
[platform/upstream/dldt.git] / ngraph / core / include / ngraph / op / power.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             // clang-format off
28             /// \brief Elementwise exponentiation operation.
29             ///
30             /// ## Inputs
31             ///
32             /// |        | Type                              | Description                                            |
33             /// | ------ | --------------------------------- | ------------------------------------------------------ |
34             /// | `arg0` | \f$N[d_1,\dots,d_n]~(n \geq 0)\f$ | A tensor of any shape and numeric element type.        |
35             /// | `arg1` | \f$N[d_1,\dots,d_n]~(n \geq 0)\f$ | A tensor of the same shape and element type as `arg0`. |
36             ///
37             /// ## Output
38             ///
39             /// | Type                   | Description                                                                                                    |
40             /// | ---------------------- | -------------------------------------------------------------------------------------------------------------- |
41             /// | \f$N[d_1,\dots,d_n]\f$ | The tensor \f$T\f$, where \f$T[i_1,\dots,i_n] = \texttt{arg0}[i_1,\dots,i_n]^{\texttt{arg1}[i_1,\dots,i_n]}\f$ |
42             // clang-format on
43             class NGRAPH_DEPRECATED(
44                 "This operation is deprecated and will be removed soon. "
45                 "Use v1::Power instead of it.") NGRAPH_API Power
46                 : public util::BinaryElementwiseArithmetic
47             {
48                 NGRAPH_SUPPRESS_DEPRECATED_START
49             public:
50                 static constexpr NodeTypeInfo type_info{"Power", 0};
51                 const NodeTypeInfo& get_type_info() const override { return type_info; }
52                 Power()
53                     : util::BinaryElementwiseArithmetic(AutoBroadcastSpec::NONE)
54                 {
55                 }
56                 /// \brief Constructs an exponentiation operation.
57                 ///
58                 /// \param arg0 Node that produces the first input tensor.
59                 /// \param arg1 Node that produces the second input tensor.
60                 /// \param auto_broadcast Auto broadcast specification
61                 Power(const Output<Node>& arg0,
62                       const Output<Node>& arg1,
63                       const AutoBroadcastSpec& auto_broadcast = AutoBroadcastSpec());
64
65                 virtual std::shared_ptr<Node>
66                     clone_with_new_inputs(const OutputVector& new_args) const override;
67                 bool evaluate(const HostTensorVector& outputs,
68                               const HostTensorVector& inputs) const override;
69                 NGRAPH_SUPPRESS_DEPRECATED_END
70             };
71         } // namespace v0
72
73         namespace v1
74         {
75             // clang-format off
76             /// \brief Elementwise exponentiation operation.
77             ///
78             /// ## Inputs
79             ///
80             /// |        | Type                              | Description                                            |
81             /// | ------ | --------------------------------- | ------------------------------------------------------ |
82             /// | `arg0` | \f$N[d_1,\dots,d_n]~(n \geq 0)\f$ | A tensor of any shape and numeric element type.        |
83             /// | `arg1` | \f$N[d_1,\dots,d_n]~(n \geq 0)\f$ | A tensor of the same shape and element type as `arg0`. |
84             ///
85             /// ## Output
86             ///
87             /// | Type                   | Description                                                                                                    |
88             /// | ---------------------- | -------------------------------------------------------------------------------------------------------------- |
89             /// | \f$N[d_1,\dots,d_n]\f$ | The tensor \f$T\f$, where \f$T[i_1,\dots,i_n] = \texttt{arg0}[i_1,\dots,i_n]^{\texttt{arg1}[i_1,\dots,i_n]}\f$ |
90             // clang-format on
91             class NGRAPH_API Power : public util::BinaryElementwiseArithmetic
92             {
93             public:
94                 static constexpr NodeTypeInfo type_info{"Power", 1};
95                 const NodeTypeInfo& get_type_info() const override { return type_info; }
96                 Power()
97                     : util::BinaryElementwiseArithmetic(AutoBroadcastSpec::NUMPY)
98                 {
99                 }
100
101                 /// \brief Constructs an exponentiation operation.
102                 ///
103                 /// \param arg0 Node that produces the first input tensor.
104                 /// \param arg1 Node that produces the second input tensor.
105                 /// \param auto_broadcast Auto broadcast specification
106                 Power(const Output<Node>& arg0,
107                       const Output<Node>& arg1,
108                       const AutoBroadcastSpec& auto_broadcast =
109                           AutoBroadcastSpec(AutoBroadcastType::NUMPY));
110
111                 virtual std::shared_ptr<Node>
112                     clone_with_new_inputs(const OutputVector& new_args) const override;
113                 bool evaluate(const HostTensorVector& outputs,
114                               const HostTensorVector& inputs) const override;
115             };
116         } // namespace v1
117
118         NGRAPH_SUPPRESS_DEPRECATED_START
119         using v0::Power;
120         NGRAPH_SUPPRESS_DEPRECATED_END
121     }
122 }