Deprecate nGraph v0 ops and builders (#1856)
[platform/upstream/dldt.git] / ngraph / core / include / ngraph / op / quantized_convolution.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/coordinate_diff.hpp"
20 #include "ngraph/op/op.hpp"
21
22 namespace ngraph
23 {
24     namespace op
25     {
26         namespace v0
27         {
28             class NGRAPH_DEPRECATED(
29                 "This operation is deprecated and will be removed soon. Please do not use it.")
30                 NGRAPH_API QuantizedConvolution : public Op
31             {
32                 NGRAPH_SUPPRESS_DEPRECATED_START
33             public:
34                 static constexpr NodeTypeInfo type_info{"QuantizedConvolution", 0};
35                 const NodeTypeInfo& get_type_info() const override { return type_info; }
36                 /// \brief Constructs a quantized convolution operation.
37                 ///
38                 /// \param input The node producing the input data batch tensor.
39                 /// \param filters The node producing the filters tensor.
40                 /// \param window_movement_strides The window movement strides.
41                 /// \param window_dilation_strides The window dilation strides.
42                 /// \param padding_below The padding-below sizes.
43                 /// \param padding_above The padding-above sizes.
44                 /// \param data_dilation_strides The data dilation strides.
45                 /// \param input_scale Scale to transform the input
46                 /// \param input_zero_point Zero point used for mapping
47                 /// \param filter_scale Scale to transform the filters
48                 /// \param filter_zero_point Zero point used for mapping
49                 /// \param output_scale Scale to transform the output
50                 /// \param output_zero_point Zero point used for mapping
51                 /// \param output_type Output element type
52                 /// \param input_axes Input axes set for channel wise quantization
53                 /// \param filter_axes Filter axes set for channel wise quantization
54                 /// \param output_axes Output axes set for channel wise quantization
55                 QuantizedConvolution(const Output<Node>& input,
56                                      const Output<Node>& filters,
57                                      const Strides& window_movement_strides,
58                                      const Strides& window_dilation_strides,
59                                      const CoordinateDiff& padding_below,
60                                      const CoordinateDiff& padding_above,
61                                      const Strides& data_dilation_strides,
62                                      const Output<Node>& input_scale,
63                                      const Output<Node>& input_zero_point,
64                                      const Output<Node>& filter_scale,
65                                      const Output<Node>& filter_zero_point,
66                                      const Output<Node>& output_scale,
67                                      const Output<Node>& output_zero_point,
68                                      const ngraph::element::Type& output_type,
69                                      const ngraph::AxisSet& input_axes = ngraph::AxisSet{},
70                                      const ngraph::AxisSet& filter_axes = ngraph::AxisSet{},
71                                      const ngraph::AxisSet& output_axes = ngraph::AxisSet{});
72
73                 QuantizedConvolution() = default;
74
75                 const Strides& get_window_movement_strides() const
76                 {
77                     return m_window_movement_strides;
78                 }
79                 const Strides& get_window_dilation_strides() const
80                 {
81                     return m_window_dilation_strides;
82                 }
83                 const CoordinateDiff& get_padding_below() const { return m_padding_below; }
84                 const CoordinateDiff& get_padding_above() const { return m_padding_above; }
85                 const Strides& get_data_dilation_strides() const { return m_data_dilation_strides; }
86                 std::shared_ptr<Node> get_filters() { return input_value(1).get_node_shared_ptr(); }
87                 std::shared_ptr<Node> get_data_batch()
88                 {
89                     return input_value(0).get_node_shared_ptr();
90                 }
91                 const ngraph::element::Type& get_output_type() const { return m_output_type; }
92                 const ngraph::AxisSet& get_input_axes() const { return m_input_axes; }
93                 const ngraph::AxisSet& get_filter_axes() const { return m_filter_axes; }
94                 const ngraph::AxisSet& get_output_axes() const { return m_output_axes; }
95                 void validate_and_infer_types() override;
96                 virtual std::shared_ptr<Node>
97                     clone_with_new_inputs(const OutputVector& new_args) const override;
98
99             protected:
100                 Strides m_window_movement_strides;
101                 Strides m_window_dilation_strides;
102                 CoordinateDiff m_padding_below;
103                 CoordinateDiff m_padding_above;
104                 Strides m_data_dilation_strides;
105                 ngraph::element::Type m_output_type;
106                 ngraph::AxisSet m_input_axes;
107                 ngraph::AxisSet m_filter_axes;
108                 ngraph::AxisSet m_output_axes;
109                 NGRAPH_SUPPRESS_DEPRECATED_END
110             };
111         }
112         NGRAPH_SUPPRESS_DEPRECATED_START
113         using v0::QuantizedConvolution;
114         NGRAPH_SUPPRESS_DEPRECATED_END
115     }
116 }