Deprecate nGraph v0 ops and builders (#1856)
[platform/upstream/dldt.git] / ngraph / frontend / onnx_import / src / op / qlinear_matmul.cpp
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 #include "qlinear_matmul.hpp"
18 #include "ngraph/builder/matmul_factory.hpp"
19 #include "ngraph/log.hpp"
20
21 namespace ngraph
22 {
23     namespace onnx_import
24     {
25         namespace op
26         {
27             namespace set_1
28             {
29                 OutputVector qlinear_matmul(const Node& node)
30                 {
31                     NGRAPH_SUPPRESS_DEPRECATED_START
32                     auto ng_inputs = node.get_ng_inputs();
33                     auto factory = builder::QLinearMatmulFactory(
34                         (OutputVector(std::begin(ng_inputs), std::end(ng_inputs))));
35                     std::size_t left_rank{ng_inputs.at(0).get_shape().size()};
36                     std::size_t right_rank{ng_inputs.at(1).get_shape().size()};
37
38                     if (left_rank == 0 || right_rank == 0)
39                     {
40                         NGRAPH_WARN
41                             << (node) << " "
42                             << "ONNX standard doesn't allow scalar operands, however nGraph "
43                                "accepts them. Consider use of element-wise multiplication instead "
44                                "to conform with ONNX standard.";
45                     }
46                     return factory.make_matmul_op();
47                     NGRAPH_SUPPRESS_DEPRECATED_END
48                 }
49             } // namespace set_1
50
51         } // namespace op
52
53     } // namespace onnx_import
54
55 } // namespace ngraph