2 Copyright (c) 2017-2018 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 extensions.front.mxnet.ssd_reorder_detection_out_inputs import SsdReorderDetectionOutInputs
22 from mo.utils.unittest.graph import build_graph
23 from mo.graph.graph import Node
26 class TestSsdReorderDetectionOutInputs(unittest.TestCase):
27 def test_reorder_detection_out_inputs(self):
29 {'node_1': {'type': 'Identity', 'kind': 'op', 'op': 'Placeholder'},
30 'node_2': {'type': 'Identity', 'kind': 'op', 'op': 'Placeholder'},
31 'node_3': {'type': 'Identity', 'kind': 'op', 'op': 'Placeholder'},
32 'multi_box_detection': {'type': '_contrib_MultiBoxDetection', 'kind': 'op',
33 'op': '_contrib_MultiBoxDetection'},
35 [('node_1', 'multi_box_detection'),
36 ('node_2', 'multi_box_detection'),
37 ('node_3', 'multi_box_detection')],
39 'node_1': {'shape': np.array([1, 34928])},
40 'node_2': {'shape': np.array([1, 183372])},
41 'node_3': {'shape': np.array([1, 2, 34928])},
44 pattern = SsdReorderDetectionOutInputs()
45 pattern.find_and_replace_pattern(graph)
47 node_multi_box = Node(graph, 'multi_box_detection')
49 node_input1 = node_multi_box.in_node(0)
50 node_input2 = node_multi_box.in_node(1)
51 node_input3 = node_multi_box.in_node(2)
52 self.assertEqual(node_input1.name, 'node_2')
53 self.assertEqual(node_input2.name, 'node_1')
54 self.assertEqual(node_input3.name, 'node_3')