1 //*****************************************************************************
2 // Copyright 2017-2020 Intel Corporation
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
8 // http://www.apache.org/licenses/LICENSE-2.0
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 //*****************************************************************************
17 #include "matmul_integer.hpp"
18 #include "ngraph/builder/matmul_factory.hpp"
19 #include "ngraph/log.hpp"
29 OutputVector matmul_integer(const Node& node)
31 NGRAPH_SUPPRESS_DEPRECATED_START
32 auto ng_inputs = node.get_ng_inputs();
33 auto factory = builder::MatmulIntegerFactory(
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()};
38 if (left_rank == 0 || right_rank == 0)
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.";
46 return factory.make_matmul_op();
47 NGRAPH_SUPPRESS_DEPRECATED_END
53 } // namespace onnx_import