"""
- 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.
'placeholder_2_data': {'value': None, 'shape': None, 'kind': 'data', 'data_type': None},
# ScaleShift layer
'scaleshift_1': {'type': 'ScaleShift', 'kind': 'op', 'op': 'ScaleShift', 'axis': 0},
+ 'const_scaleshift_1_w': {'value': None, 'shape': None, 'kind': 'op'},
'scaleshift_1_w': {'value': None, 'shape': None, 'kind': 'data'},
+ 'const_scaleshift_1_b': {'value': None, 'shape': None, 'kind': 'op'},
'scaleshift_1_b': {'value': None, 'shape': None, 'kind': 'data'},
'scaleshift_1_data': {'value': None, 'shape': None, 'kind': 'data'},
# Mul and Add operations
'mul_1': {'type': None, 'value': None, 'kind': 'op', 'op': 'Mul'},
+ 'const_mul_1_w': {'value': None, 'shape': None, 'kind': 'op'},
'mul_1_w': {'value': None, 'shape': None, 'kind': 'data'},
'mul_1_data': {'value': None, 'shape': None, 'kind': 'data'},
'add_1': {'type': None, 'kind': 'op', 'op': 'Add'},
+ 'const_add_1_w': {'value': None, 'shape': None, 'kind': 'op'},
'add_1_w': {'value': None, 'shape': None, 'kind': 'data'},
'add_1_data': {'value': None, 'shape': None, 'kind': 'data'},
# Mul and Add operations
'mul_2': {'type': None, 'kind': 'op', 'op': 'Mul'},
+ 'const_mul_2_w': {'value': None, 'shape': None, 'kind': 'op'},
'mul_2_w': {'value': None, 'shape': None, 'kind': 'data'},
'mul_2_data': {'value': None, 'shape': None, 'kind': 'data'},
'add_2': {'type': None, 'kind': 'op', 'op': 'Add'},
+ 'const_add_2_w': {'value': None, 'shape': None, 'kind': 'op'},
'add_2_w': {'value': None, 'shape': None, 'kind': 'data'},
'add_2_data': {'value': None, 'shape': None, 'kind': 'data'},
# Reshape
# Concat1 operation
'concat': {'type': 'Concat', 'kind': 'op', 'op': 'Concat'},
'concat_data': {'value': None, 'shape': None, 'kind': 'data'},
+ 'op_output': {'kind': 'op', 'op': 'OpOutput'}
}
graph = build_graph(nodes_attributes,
[('placeholder_1', 'placeholder_1_data'),
('placeholder_1_data', 'scaleshift_1'),
+ ('const_scaleshift_1_w', 'scaleshift_1_w'),
('scaleshift_1_w', 'scaleshift_1'),
('scaleshift_1', 'scaleshift_1_data'),
+ ('scaleshift_1_data', 'op_output')
],
{'placeholder_1_data': {'shape': np.array([1, 227, 227, 3])},
'scaleshift_1_w': {'shape': np.array([3]), 'value': np.array([1, 2, 3])},
- 'scaleshift_1_data': {'is_output': True}
+ 'scaleshift_1_data': {}
})
graph_ref = build_graph(nodes_attributes,
[('placeholder_1', 'placeholder_1_data'),
('placeholder_1_data', 'mul_1'),
+ ('const_mul_1_w', 'mul_1_w'),
('mul_1_w', 'mul_1'),
('mul_1', 'scaleshift_1_data'),
+ ('scaleshift_1_data', 'op_output')
],
{'placeholder_1_data': {'shape': np.array([1, 227, 227, 3])},
+ 'const_mul_1_w': {'shape': np.array([3]), 'value': np.array([1, 2, 3])},
'mul_1_w': {'shape': np.array([3]), 'value': np.array([1, 2, 3])},
'mul_1': {'can_be_fused': True},
- 'scaleshift_1_data': {'is_output': True}
+ 'scaleshift_1_data': {}
})
graph.graph['layout'] = 'NHWC'
convert_scale_shift_to_mul_add(graph)
graph_clean_up(graph)
- (flag, resp) = compare_graphs(graph, graph_ref, 'scaleshift_1_data')
+ (flag, resp) = compare_graphs(graph, graph_ref, 'placeholder_1')
self.assertTrue(flag, resp)
# ScaleShift 2 inputs-> Mul
('placeholder_1_data', 'scaleshift_1'),
('placeholder_2_data', 'scaleshift_1'),
('scaleshift_1', 'scaleshift_1_data'),
+ ('scaleshift_1_data', 'op_output')
],
{'placeholder_1_data': {'shape': np.array([1, 227, 227, 3])},
'placeholder_2_data': {'shape': np.array([1, 227])},
- 'scaleshift_1_data': {'is_output': True}
+ 'scaleshift_1_data': {}
})
graph_ref = build_graph(nodes_attributes,
('placeholder_1_data', 'mul_1'),
('placeholder_2/Reshape_data', 'mul_1'),
('mul_1', 'scaleshift_1_data'),
+ ('scaleshift_1_data', 'op_output')
],
{'placeholder_1_data': {'shape': np.array([1, 227, 227, 3])},
'placeholder_2_data': {'shape': np.array([1, 227])},
'placeholder_2/Reshape_': {'dim': np.array([1, 227, 1, 1])},
'placeholder_2/Reshape_data': {'shape': np.array([1, 227, 1, 1])},
'mul_1': {'can_be_fused': True},
- 'scaleshift_1_data': {'is_output': True}
+ 'scaleshift_1_data': {}
})
graph.graph['layout'] = 'NHWC'
convert_scale_shift_to_mul_add(graph)
graph_clean_up(graph)
- (flag, resp) = compare_graphs(graph, graph_ref, 'scaleshift_1_data')
+ (flag, resp) = compare_graphs(graph, graph_ref, 'placeholder_1')
self.assertTrue(flag, resp)
# ScaleShift 2 inputs-> Mul (axis = 1)
('placeholder_1_data', 'scaleshift_1'),
('placeholder_2_data', 'scaleshift_1'),
('scaleshift_1', 'scaleshift_1_data'),
+ ('scaleshift_1_data', 'op_output')
],
{'placeholder_1_data': {'shape': np.array([1, 227, 227, 3])},
'placeholder_2_data': {'shape': np.array([227])},
'scaleshift_1': {'axis': 1},
- 'scaleshift_1_data': {'is_output': True}
+ 'scaleshift_1_data': {}
})
graph_ref = build_graph(nodes_attributes,
('placeholder_1_data', 'mul_1'),
('placeholder_2/Reshape_data', 'mul_1'),
('mul_1', 'scaleshift_1_data'),
+ ('scaleshift_1_data', 'op_output')
],
{'placeholder_1_data': {'shape': np.array([1, 227, 227, 3])},
'placeholder_2_data': {'shape': np.array([227])},
'placeholder_2/Reshape_': {'dim': np.array([1, 227, 1, 1])},
'placeholder_2/Reshape_data': {'shape': np.array([1, 227, 1, 1])},
'mul_1': {'can_be_fused': True},
- 'scaleshift_1_data': {'is_output': True}
+ 'scaleshift_1_data': {}
})
graph.graph['layout'] = 'NHWC'
convert_scale_shift_to_mul_add(graph)
graph_clean_up(graph)
- (flag, resp) = compare_graphs(graph, graph_ref, 'scaleshift_1_data')
+ (flag, resp) = compare_graphs(graph, graph_ref, 'placeholder_1')
self.assertTrue(flag, resp)
-
# ScaleShift -> Mul (Zero biases)
def test_scaleshift_to_mul_2(self):
graph = build_graph(nodes_attributes,
[('placeholder_1', 'placeholder_1_data'),
('placeholder_1_data', 'scaleshift_1'),
+ ('const_scaleshift_1_w', 'scaleshift_1_w'),
+ ('const_scaleshift_1_b', 'scaleshift_1_b'),
('scaleshift_1_w', 'scaleshift_1'),
('scaleshift_1_b', 'scaleshift_1'),
('scaleshift_1', 'scaleshift_1_data'),
+ ('scaleshift_1_data', 'op_output')
],
{'placeholder_1_data': {'shape': np.array([1, 227, 227, 3])},
'scaleshift_1_w': {'shape': np.array([3]), 'value': np.array([1, 2, 3])},
'scaleshift_1_b': {'shape': np.array([3]), 'value': np.array([0, 0, 0])},
- 'scaleshift_1_data': {'is_output': True}
+ 'scaleshift_1_data': {}
})
graph_ref = build_graph(nodes_attributes,
[('placeholder_1', 'placeholder_1_data'),
('placeholder_1_data', 'mul_1'),
+ ('const_mul_1_w', 'mul_1_w'),
('mul_1_w', 'mul_1'),
('mul_1', 'scaleshift_1_data'),
+ ('scaleshift_1_data', 'op_output')
],
{'placeholder_1_data': {'shape': np.array([1, 227, 227, 3])},
+ 'const_mul_1_w': {'shape': np.array([3]), 'value': np.array([1, 2, 3])},
'mul_1_w': {'shape': np.array([3]), 'value': np.array([1, 2, 3])},
'mul_1': {'can_be_fused': True},
- 'scaleshift_1_data': {'is_output': True}
+ 'scaleshift_1_data': {}
})
graph.graph['layout'] = 'NHWC'
convert_scale_shift_to_mul_add(graph)
graph_clean_up(graph)
- (flag, resp) = compare_graphs(graph, graph_ref, 'scaleshift_1_data')
+ (flag, resp) = compare_graphs(graph, graph_ref, 'placeholder_1')
self.assertTrue(flag, resp)
# ScaleShift -> Mul->Add
graph = build_graph(nodes_attributes,
[('placeholder_1', 'placeholder_1_data'),
('placeholder_1_data', 'scaleshift_1'),
+ ('const_scaleshift_1_w', 'scaleshift_1_w'),
+ ('const_scaleshift_1_b', 'scaleshift_1_b'),
('scaleshift_1_w', 'scaleshift_1'),
('scaleshift_1_b', 'scaleshift_1'),
('scaleshift_1', 'scaleshift_1_data'),
+ ('scaleshift_1_data', 'op_output')
],
{'placeholder_1_data': {'shape': np.array([1, 227, 227, 3])},
'scaleshift_1_w': {'shape': np.array([3]), 'value': np.array([1, 2, 3])},
'scaleshift_1_b': {'shape': np.array([3]), 'value': np.array([3, 2, 1])},
- 'scaleshift_1_data': {'is_output': True}
+ 'scaleshift_1_data': {}
})
graph_ref = build_graph(nodes_attributes,
[('placeholder_1', 'placeholder_1_data'),
('placeholder_1_data', 'mul_1'),
+ ('const_mul_1_w', 'mul_1_w'),
('mul_1_w', 'mul_1'),
('mul_1', 'mul_1_data'),
('mul_1_data', 'add_1'),
+ ('const_add_1_w', 'add_1_w'),
('add_1_w', 'add_1'),
('add_1', 'scaleshift_1_data'),
+ ('scaleshift_1_data', 'op_output')
],
{'placeholder_1_data': {'shape': np.array([1, 227, 227, 3])},
+ 'const_mul_1_w': {'shape': np.array([3]), 'value': np.array([1, 2, 3])},
'mul_1_w': {'shape': np.array([3]), 'value': np.array([1, 2, 3])},
+ 'const_add_1_w': {'shape': np.array([3]), 'value': np.array([3, 2, 1])},
'add_1_w': {'shape': np.array([3]), 'value': np.array([3, 2, 1])},
'mul_1_data': {'shape': np.array([1, 227, 227, 3])},
'add_1': {'can_be_fused': True},
'mul_1': {'can_be_fused': True},
- 'scaleshift_1_data': {'is_output': True}
+ 'scaleshift_1_data': {}
})
graph.graph['layout'] = 'NHWC'
convert_scale_shift_to_mul_add(graph)
graph_clean_up(graph)
- (flag, resp) = compare_graphs(graph, graph_ref, 'scaleshift_1_data')
+ (flag, resp) = compare_graphs(graph, graph_ref, 'placeholder_1')
self.assertTrue(flag, resp)
# ScaleShift -> None (Zero weights and biases)
graph = build_graph(nodes_attributes,
[('placeholder_1', 'placeholder_1_data'),
('placeholder_1_data', 'scaleshift_1'),
+ ('const_scaleshift_1_w', 'scaleshift_1_w'),
+ ('const_scaleshift_1_b', 'scaleshift_1_b'),
('scaleshift_1_w', 'scaleshift_1'),
('scaleshift_1_b', 'scaleshift_1'),
('scaleshift_1', 'scaleshift_1_data'),
+ ('scaleshift_1_data', 'op_output')
],
{'placeholder_1_data': {'shape': np.array([1, 227, 227, 3])},
'scaleshift_1_w': {'shape': np.array([3]), 'value': np.array([1, 1, 1])},
'scaleshift_1_b': {'shape': np.array([3]), 'value': np.array([0, 0, 0])},
- 'scaleshift_1_data': {'shape': np.array([1, 227, 227, 3]), 'is_output': True}
- })
+ 'scaleshift_1_data': {'shape': np.array([1, 227, 227, 3])}
+ }, nodes_with_edges_only=True)
graph_ref = build_graph(nodes_attributes,
- [('placeholder_1', 'placeholder_1_data')],
- {'placeholder_1_data': {'shape': np.array([1, 227, 227, 3]), 'is_output': True}})
+ [('placeholder_1', 'placeholder_1_data'),
+ ('placeholder_1_data', 'op_output')
+ ],
+ {'placeholder_1_data': {'shape': np.array([1, 227, 227, 3])}}
+ ,nodes_with_edges_only=True)
graph.graph['layout'] = 'NHWC'
convert_scale_shift_to_mul_add(graph)
graph_clean_up(graph)
- (flag, resp) = compare_graphs(graph, graph_ref, 'placeholder_1_data')
+ (flag, resp) = compare_graphs(graph, graph_ref, 'placeholder_1')
self.assertTrue(flag, resp)
# ScaleShift -> ScaleShift (can_be_fused=False)
graph = build_graph(nodes_attributes,
[('placeholder_1', 'placeholder_1_data'),
('placeholder_1_data', 'scaleshift_1'),
+ ('const_scaleshift_1_w', 'scaleshift_1_w'),
+ ('const_scaleshift_1_b', 'scaleshift_1_b'),
('scaleshift_1_w', 'scaleshift_1'),
('scaleshift_1_b', 'scaleshift_1'),
('scaleshift_1', 'scaleshift_1_data'),
+ ('scaleshift_1_data', 'op_output')
],
{'placeholder_1_data': {'shape': np.array([1, 227, 227, 3])},
'scaleshift_1_w': {'shape': np.array([3]), 'value': np.array([1, 1, 1])},
'scaleshift_1_b': {'shape': np.array([3]), 'value': np.array([0, 0, 0])},
'scaleshift_1': {'can_be_fused': False},
- 'scaleshift_1_data': {'shape': np.array([1, 227, 227, 3]), 'is_output': True}
+ 'scaleshift_1_data': {'shape': np.array([1, 227, 227, 3])}
})
graph_ref = build_graph(nodes_attributes,
[('placeholder_1', 'placeholder_1_data'),
('placeholder_1_data', 'scaleshift_1'),
+ ('const_scaleshift_1_w', 'scaleshift_1_w'),
+ ('const_scaleshift_1_b', 'scaleshift_1_b'),
('scaleshift_1_w', 'scaleshift_1'),
('scaleshift_1_b', 'scaleshift_1'),
('scaleshift_1', 'scaleshift_1_data'),
+ ('scaleshift_1_data', 'op_output')
],
{'placeholder_1_data': {'shape': np.array([1, 227, 227, 3])},
+ 'const_scaleshift_1_w': {'shape': np.array([3]), 'value': np.array([1, 1, 1])},
'scaleshift_1_w': {'shape': np.array([3]), 'value': np.array([1, 1, 1])},
+ 'const_scaleshift_1_b': {'shape': np.array([3]), 'value': np.array([0, 0, 0])},
'scaleshift_1_b': {'shape': np.array([3]), 'value': np.array([0, 0, 0])},
'scaleshift_1': {'can_be_fused': False},
- 'scaleshift_1_data': {'shape': np.array([1, 227, 227, 3]), 'is_output': True}
+ 'scaleshift_1_data': {'shape': np.array([1, 227, 227, 3])}
})
convert_scale_shift_to_mul_add(graph)
('bn_var', 'bn_op'),
('bn_op', 'bn_data'),
('concat', 'concat_data'),
- ('bn_data', 'concat')
+ ('bn_data', 'concat'),
+ ('concat_data', 'op_output')
],
{'placeholder_1_data': {'shape': np.array([1, 227, 227, 3])},
'bn_op': {'eps': 1.2},
'bn_mean': {'shape': np.array([3]), 'value': np.array([1, 2, 3])},
'bn_var': {'shape': np.array([3]), 'value': np.array([1, 2, 3])},
'bn_data': {'shape': np.array([1, 227, 227, 3])},
- 'concat_data': {'is_output': True}
+ 'concat_data': {}
})
graph_ref = build_graph(nodes_attributes,
[('placeholder_1', 'placeholder_1_data'),
('placeholder_1_data', 'mul_1'),
+ ('const_mul_1_w', 'mul_1_w'),
('mul_1_w', 'mul_1'),
('mul_1', 'mul_1_data'),
('mul_1_data', 'add_1'),
+ ('const_add_1_w', 'add_1_w'),
('add_1_w', 'add_1'),
('add_1', 'add_1_data'),
('add_1_data', 'mul_2'),
+ ('const_mul_2_w', 'mul_2_w'),
('mul_2_w', 'mul_2'),
('mul_2', 'mul_2_data'),
('mul_2_data', 'add_2'),
+ ('const_add_2_w', 'add_2_w'),
('add_2_w', 'add_2'),
('add_2', 'add_2_data'),
('concat', 'concat_data'),
- ('add_2_data', 'concat')
+ ('add_2_data', 'concat'),
+ ('concat_data', 'op_output')
],
{'placeholder_1_data': {'shape': np.array([1, 227, 227, 3])},
+ 'const_mul_1_w': {'shape': np.array([3]),
+ 'value': np.array([0.67419986, 0.55901699, 0.48795004])},
'mul_1_w': {'shape': np.array([3]),
'value': np.array([0.67419986, 0.55901699, 0.48795004])},
+ 'const_mul_2_w': {'shape': np.array([3]), 'value': np.array([1, 2, 3])},
'mul_2_w': {'shape': np.array([3]), 'value': np.array([1, 2, 3])},
+ 'const_add_1_w': {'shape': np.array([3]),
+ 'value': np.array([-0.67419986, -1.11803399, -1.46385011])},
'add_1_w': {'shape': np.array([3]),
'value': np.array([-0.67419986, -1.11803399, -1.46385011])},
+ 'const_add_2_w': {'shape': np.array([3]), 'value': np.array([1, 2, 3])},
'add_2_w': {'shape': np.array([3]), 'value': np.array([1, 2, 3])},
'add_2_data': {'shape': np.array([1, 227, 227, 3])},
'mul_1': {'can_be_fused': True},
'mul_2': {'can_be_fused': True},
'add_1': {'can_be_fused': True},
'add_2': {'can_be_fused': True},
- 'concat_data': {'is_output': True}
+ 'concat_data': {}
})
graph.graph['layout'] = 'NHWC'
('bn_var', 'bn_op'),
('bn_op', 'bn_data'),
('concat', 'concat_data'),
- ('bn_data', 'concat')
+ ('bn_data', 'concat'),
+ ('concat_data', 'op_output')
],
{'placeholder_1_data': {'shape': np.array([1, 227, 227, 3])},
'bn_op': {'eps': 1.2, 'can_be_fused': False},
'bn_mean': {'shape': np.array([3]), 'value': np.array([1, 2, 3])},
'bn_var': {'shape': np.array([3]), 'value': np.array([1, 2, 3])},
'bn_data': {'shape': np.array([1, 227, 227, 3])},
- 'concat_data': {'is_output': True}
+ 'concat_data': {}
})
graph_ref = build_graph(nodes_attributes,
[('placeholder_1', 'placeholder_1_data'),
('placeholder_1_data', 'mul_1'),
+ ('const_mul_1_w', 'mul_1_w'),
('mul_1_w', 'mul_1'),
('mul_1', 'mul_1_data'),
('mul_1_data', 'add_1'),
+ ('const_add_1_w', 'add_1_w'),
('add_1_w', 'add_1'),
('add_1', 'add_1_data'),
('add_1_data', 'mul_2'),
+ ('const_mul_2_w', 'mul_2_w'),
('mul_2_w', 'mul_2'),
('mul_2', 'mul_2_data'),
('mul_2_data', 'add_2'),
+ ('const_add_2_w', 'add_2_w'),
('add_2_w', 'add_2'),
('add_2', 'add_2_data'),
('concat', 'concat_data'),
- ('add_2_data', 'concat')
+ ('add_2_data', 'concat'),
+ ('concat_data', 'op_output')
],
{'placeholder_1_data': {'shape': np.array([1, 227, 227, 3])},
+ 'const_mul_1_w': {'shape': np.array([3]),
+ 'value': np.array([0.67419986, 0.55901699, 0.48795004])},
'mul_1_w': {'shape': np.array([3]),
'value': np.array([0.67419986, 0.55901699, 0.48795004])},
+ 'const_mul_2_w': {'shape': np.array([3]), 'value': np.array([1, 2, 3])},
'mul_2_w': {'shape': np.array([3]), 'value': np.array([1, 2, 3])},
+ 'const_add_1_w': {'shape': np.array([3]),
+ 'value': np.array([-0.67419986, -1.11803399, -1.46385011])},
'add_1_w': {'shape': np.array([3]),
'value': np.array([-0.67419986, -1.11803399, -1.46385011])},
+ 'const_add_2_w': {'shape': np.array([3]), 'value': np.array([1, 2, 3])},
'add_2_w': {'shape': np.array([3]), 'value': np.array([1, 2, 3])},
'add_2_data': {'shape': np.array([1, 227, 227, 3])},
'mul_1': {'can_be_fused': False},
'mul_2': {'can_be_fused': False},
'add_1': {'can_be_fused': False},
'add_2': {'can_be_fused': False},
- 'concat_data': {'is_output': True}
+ 'concat_data': {}
})
graph.graph['layout'] = 'NHWC'
('bn_var', 'bn_op'),
('bn_op', 'bn_data'),
('concat', 'concat_data'),
- ('bn_data', 'concat')
+ ('bn_data', 'concat'),
+ ('concat_data', 'op_output')
],
{'placeholder_1_data': {'shape': np.array([1, 227, 227, 3])},
'bn_op': {'epsilon': 1.2, 'op': 'BatchNormalization'},
'bn_mean': {'shape': np.array([3]), 'value': np.array([1, 2, 3])},
'bn_var': {'shape': np.array([3]), 'value': np.array([1, 2, 3])},
'bn_data': {'shape': np.array([1, 227, 227, 3])},
- 'concat_data': {'is_output': True}
+ 'concat_data': {}
})
del graph['placeholder_1']['placeholder_1_data'][0]['in']
graph_ref = build_graph(nodes_attributes,
[('placeholder_1', 'placeholder_1_data'),
('placeholder_1_data', 'mul_1'),
+ ('const_mul_1_w', 'mul_1_w'),
('mul_1_w', 'mul_1'),
('mul_1', 'mul_1_data'),
('mul_1_data', 'add_1'),
+ ('const_add_1_w', 'add_1_w'),
('add_1_w', 'add_1'),
('add_1', 'add_1_data'),
('concat', 'concat_data'),
- ('add_1_data', 'concat')
+ ('add_1_data', 'concat'),
+ ('concat_data', 'op_output')
],
{'placeholder_1_data': {'shape': np.array([1, 227, 227, 3])},
+ 'const_mul_1_w': {'shape': np.array([3]),
+ 'value': np.array([0.67419986, 0.55901699, 0.48795004])},
'mul_1_w': {'shape': np.array([3]),
'value': np.array([0.67419986, 0.55901699, 0.48795004])},
+ 'const_add_1_w': {'shape': np.array([3]),
+ 'value': np.array([-0.67419986, -1.11803399, -1.46385011])},
'add_1_w': {'shape': np.array([3]),
'value': np.array([-0.67419986, -1.11803399, -1.46385011])},
'add_1_data': {'shape': np.array([1, 227, 227, 3])},
'mul_1': {'can_be_fused': True},
'add_1': {'can_be_fused': True},
- 'concat_data': {'is_output': True}
+ 'concat_data': {}
})
graph.graph['layout'] = 'NHWC'
('bn_var', 'bn_op'),
('bn_op', 'bn_data'),
('concat', 'concat_data'),
- ('bn_data', 'concat')
+ ('bn_data', 'concat'),
+ ('concat_data', 'op_output')
],
{'placeholder_1_data': {'shape': np.array([1, 227, 227, 3])},
'bn_op': {'epsilon': 1.2, 'op': 'BatchNormalization', 'can_be_fused': False},
'bn_mean': {'shape': np.array([3]), 'value': np.array([1, 2, 3])},
'bn_var': {'shape': np.array([3]), 'value': np.array([1, 2, 3])},
'bn_data': {'shape': np.array([1, 227, 227, 3])},
- 'concat_data': {'is_output': True}
+ 'concat_data': {}
})
del graph['placeholder_1']['placeholder_1_data'][0]['in']
graph_ref = build_graph(nodes_attributes,
[('placeholder_1', 'placeholder_1_data'),
('placeholder_1_data', 'mul_1'),
+ ('const_mul_1_w', 'mul_1_w'),
('mul_1_w', 'mul_1'),
('mul_1', 'mul_1_data'),
('mul_1_data', 'add_1'),
+ ('const_add_1_w', 'add_1_w'),
('add_1_w', 'add_1'),
('add_1', 'add_1_data'),
('concat', 'concat_data'),
- ('add_1_data', 'concat')
+ ('add_1_data', 'concat'),
+ ('concat_data', 'op_output')
],
{'placeholder_1_data': {'shape': np.array([1, 227, 227, 3])},
+ 'const_mul_1_w': {'shape': np.array([3]),
+ 'value': np.array([0.67419986, 0.55901699, 0.48795004])},
'mul_1_w': {'shape': np.array([3]),
'value': np.array([0.67419986, 0.55901699, 0.48795004])},
+ 'const_add_1_w': {'shape': np.array([3]),
+ 'value': np.array([-0.67419986, -1.11803399, -1.46385011])},
'add_1_w': {'shape': np.array([3]),
'value': np.array([-0.67419986, -1.11803399, -1.46385011])},
'add_1_data': {'shape': np.array([1, 227, 227, 3])},
'mul_1': {'can_be_fused': False},
'add_1': {'can_be_fused': False},
- 'concat_data': {'is_output': True}
+ 'concat_data': {}
})
graph.graph['layout'] = 'NHWC'