"""
- Copyright (c) 2018 Intel Corporation
+ Copyright (c) 2018-2019 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
nodes_attributes = {'node_1': {'type': 'Identity', 'value': None, 'kind': 'data'},
'pb': {'type': 'PriorBox', 'value': None, 'kind': 'op'},
- 'node_3': {'type': 'Identity', 'value': None, 'kind': 'data'}
- }
+ 'node_3': {'type': 'Identity', 'value': None, 'kind': 'data'},
+ 'op_output': { 'kind': 'op', 'op': 'OpOutput'}
+ }
class TestPriorBoxPartialInfer(unittest.TestCase):
graph = build_graph(nodes_attributes,
[
('node_1', 'pb'),
- ('pb', 'node_3')],
+ ('pb', 'node_3'),
+ ('node_3', 'op_output')
+ ],
{
- 'node_3': {'is_output': True, 'shape': None},
+ 'node_3': {'shape': None},
'node_1': {'shape': np.array([1, 384, 19, 19])},
'pb': {
'aspect_ratio': np.array([1]),
graph.graph['layout'] = 'NCHW'
pb_node = Node(graph, 'pb')
PriorBoxOp.priorbox_infer(pb_node)
- exp_shape = np.array([1, 2, 4*19*19*2])
+ exp_shape = np.array([1, 2, 4 * 19 * 19 * 2])
res_shape = graph.node['node_3']['shape']
for i in range(0, len(exp_shape)):
self.assertEqual(exp_shape[i], res_shape[i])
graph = build_graph(nodes_attributes,
[
('node_1', 'pb'),
- ('pb', 'node_3')],
+ ('pb', 'node_3'),
+ ('node_3', 'op_output')
+ ],
{
- 'node_3': {'is_output': True, 'shape': None},
+ 'node_3': {'shape': None},
'node_1': {'shape': np.array([1, 384, 19, 19])},
'pb': {
'aspect_ratio': np.array([1, 2, 0.5]),
graph.graph['layout'] = 'NCHW'
pb_node = Node(graph, 'pb')
PriorBoxOp.priorbox_infer(pb_node)
- exp_shape = np.array([1, 2, 4*19*19*4])
+ exp_shape = np.array([1, 2, 4 * 19 * 19 * 4])
res_shape = graph.node['node_3']['shape']
for i in range(0, len(exp_shape)):
self.assertEqual(exp_shape[i], res_shape[i])
graph = build_graph(nodes_attributes,
[
('node_1', 'pb'),
- ('pb', 'node_3')],
+ ('pb', 'node_3'),
+ ('node_3', 'op_output')
+ ],
{
- 'node_3': {'is_output': True, 'shape': None},
+ 'node_3': {'shape': None},
'node_1': {'shape': np.array([1, 19, 19, 384])},
'pb': {
'aspect_ratio': np.array([1]),
graph.graph['layout'] = 'NHWC'
pb_node = Node(graph, 'pb')
PriorBoxOp.priorbox_infer(pb_node)
- exp_shape = np.array([1, 2, 4*19*19*2])
+ exp_shape = np.array([1, 2, 4 * 19 * 19 * 2])
res_shape = graph.node['node_3']['shape']
for i in range(0, len(exp_shape)):
self.assertEqual(exp_shape[i], res_shape[i])
graph = build_graph(nodes_attributes,
[
('node_1', 'pb'),
- ('pb', 'node_3')],
+ ('pb', 'node_3'),
+ ('node_3', 'op_output')
+ ],
{
- 'node_3': {'is_output': True, 'shape': None},
+ 'node_3': {'shape': None},
'node_1': {'shape': np.array([1, 19, 19, 384])},
'pb': {
'aspect_ratio': np.array([1, 2, 0.5]),
graph.graph['layout'] = 'NHWC'
pb_node = Node(graph, 'pb')
PriorBoxOp.priorbox_infer(pb_node)
- exp_shape = np.array([1, 2, 4*19*19*4])
+ exp_shape = np.array([1, 2, 4 * 19 * 19 * 4])
res_shape = graph.node['node_3']['shape']
for i in range(0, len(exp_shape)):
self.assertEqual(exp_shape[i], res_shape[i])