2 Copyright (c) 2018-2019 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.
21 from generator import generator, generate
23 from extensions.front.onnx.squeeze_ext import SqueezeFrontExtractor
24 from mo.ops.op import Op
25 from mo.ops.squeeze import Squeeze
26 from mo.utils.unittest.extractors import PB
30 class TestSqueezeONNXExt(unittest.TestCase):
32 def _create_squeeze_node(axes):
34 pb = onnx.helper.make_node(
40 pb = onnx.helper.make_node(
52 Op.registered_ops['Squeeze'] = Squeeze
54 @generate(*[[0, 1, 2, 3], [1], None])
55 def test_squeeze_ext(self, axes):
56 node = self._create_squeeze_node(axes)
57 SqueezeFrontExtractor.extract(node)
64 for key in exp_res.keys():
65 if type(node[key]) in [list, np.ndarray]:
66 self.assertTrue(np.array_equal(np.array(node[key]), np.array(exp_res[key])))
68 self.assertEqual(node[key], exp_res[key])