Deprecate nGraph v0 ops and builders (#1856)
[platform/upstream/dldt.git] / ngraph / core / include / ngraph / op / dot.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 <utility>
20
21 #include "ngraph/op/op.hpp"
22
23 namespace ngraph
24 {
25     namespace op
26     {
27         namespace v0
28         {
29             /// \brief Generalized dot product operation, including scalar-tensor product,
30             /// matrix-vector
31             ///        product, and matrix multiplication.
32             class NGRAPH_DEPRECATED(
33                 "This operation is deprecated and will be removed soon. Please do not use it.")
34                 NGRAPH_API Dot : public Op
35             {
36                 NGRAPH_SUPPRESS_DEPRECATED_START
37             public:
38                 static constexpr NodeTypeInfo type_info{"Dot", 0};
39                 const NodeTypeInfo& get_type_info() const override { return type_info; }
40                 /// \brief Constructs a dot product operation.
41                 Dot() = default;
42                 /// \brief Constructs a dot product operation.
43                 ///
44                 /// \param arg0 The node producing the first argument.
45                 /// \param arg1 The node producing the second argument.
46                 /// \param reduction_axes_count The number of axes to dot.
47                 Dot(const Output<Node>& arg0,
48                     const Output<Node>& arg1,
49                     size_t reduction_axes_count,
50                     bool has_reduction_axes_count = true);
51
52                 /// \brief Constructs a dot product operation with default dot-axis selection
53                 /// depending
54                 ///        on the inputs.
55                 ///
56                 /// If `arg0` or `arg1` is a scalar, there are no dot-axes. Else, there is one
57                 /// dot-axis.
58                 ///
59                 /// (Note that in particular, this results in scalar-tensor products where one or
60                 /// the
61                 /// other argument is a scalar, a matrix-vector products where `arg0` is a matrix
62                 /// and
63                 /// `arg1` is a vector, and a matrix multiplication where `arg0` and `arg1` are both
64                 /// matrices.)
65                 ///
66                 /// \param arg0 The node producing the first argument.
67                 /// \param arg1 The node producing the second argument.
68                 Dot(const Output<Node>& arg0, const Output<Node>& arg1);
69
70                 void validate_and_infer_types() override;
71
72                 virtual std::shared_ptr<Node> get_default_value() const override;
73
74                 size_t get_reduction_axes_count() const { return m_reduction_axes_count; }
75                 void set_reduction_axes_count(size_t reduction_axes_count)
76                 {
77                     m_reduction_axes_count = reduction_axes_count;
78                 }
79                 bool get_has_reduction_axes_count() const { return m_has_reduction_axes_count; }
80                 void set_has_reduction_axes_count(bool has_reduction_axes_count)
81                 {
82                     m_has_reduction_axes_count = has_reduction_axes_count;
83                 }
84                 virtual std::shared_ptr<Node>
85                     clone_with_new_inputs(const OutputVector& new_args) const override
86                 {
87                     check_new_args_count(this, new_args);
88                     return std::make_shared<Dot>(
89                         new_args.at(0), new_args.at(1), m_reduction_axes_count);
90                 }
91
92             protected:
93                 size_t m_reduction_axes_count;
94                 bool m_has_reduction_axes_count;
95                 NGRAPH_SUPPRESS_DEPRECATED_END
96             };
97         }
98         NGRAPH_SUPPRESS_DEPRECATED_START
99         using v0::Dot;
100         NGRAPH_SUPPRESS_DEPRECATED_END
101     }
102 }