Publishing 2019 R1 content
[platform/upstream/dldt.git] / model-optimizer / mo / middle / passes / fusing / fuse_linear_ops_test.py
index 30948e2..a73bdd4 100644 (file)
@@ -1,5 +1,5 @@
 """
- 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.
@@ -30,20 +30,26 @@ nodes_attributes = {
     'scaleshift_1': {'type': 'ScaleShift', 'kind': 'op', 'op': 'ScaleShift'},
     'scaleshift_1_w': {'value': None, 'shape': None, 'kind': 'data'},
     'scaleshift_1_b': {'value': None, 'shape': None, 'kind': 'data'},
+    'const_scaleshift_1_w': {'value': None, 'shape': None, 'kind': 'op', 'data_type': None},
+    'const_scaleshift_1_b': {'value': None, 'shape': None, 'kind': 'op', 'data_type': None},
     'scaleshift_1_data': {'value': None, 'shape': None, 'kind': 'data'},
     # Mul and Add operations
     'mul_1': {'type': 'Mul', 'kind': 'op', 'op': 'Mul', 'can_be_fused': True},
     'mul_1_w': {'value': None, 'shape': None, 'kind': 'data', 'data_type': None},
+    'const_mul_1_w': {'value': None, 'shape': None, 'kind': 'op', 'data_type': None},
     'mul_1_data': {'value': None, 'shape': None, 'kind': 'data', 'data_type': None},
     'add_1': {'type': 'Add', 'kind': 'op', 'op': 'Add', 'can_be_fused': True},
     'add_1_w': {'value': None, 'shape': None, 'kind': 'data', 'data_type': None},
+    'const_add_1_w': {'value': None, 'shape': None, 'kind': 'op', 'data_type': None},
     'add_1_data': {'value': None, 'shape': None, 'kind': 'data', 'data_type': None},
     # Mul2 and Add2 operations
     'mul_2': {'type': 'Mul', 'kind': 'op', 'op': 'Mul', 'can_be_fused': True},
     'mul_2_w': {'value': None, 'shape': None, 'kind': 'data', 'data_type': None},
+    'const_mul_2_w': {'value': None, 'shape': None, 'kind': 'op', 'data_type': None},
     'mul_2_data': {'value': None, 'shape': None, 'kind': 'data', 'data_type': None},
     'add_2': {'type': 'Add', 'kind': 'op', 'op': 'Add', 'can_be_fused': True},
     'add_2_w': {'value': None, 'shape': None, 'kind': 'data', 'data_type': None},
+    'const_add_2_w': {'value': None, 'shape': None, 'kind': 'op', 'data_type': None},
     'add_2_data': {'value': None, 'shape': None, 'kind': 'data', 'data_type': None},
     # Concat1 operation
     'concat_1': {'type': 'Concat', 'kind': 'op', 'op': 'Concat'},
@@ -52,21 +58,30 @@ nodes_attributes = {
     'conv_1': {'type': 'Convolution', 'kind': 'op', 'op': 'Conv2D', 'layout': 'NHWC'},
     'conv_1_w': {'value': None, 'shape': None, 'kind': 'data'},
     'conv_1_b': {'value': None, 'shape': None, 'kind': 'data'},
+    'const_conv_1_w': {'value': None, 'shape': None, 'kind': 'op', 'data_type': None},
+    'const_conv_1_b': {'value': None, 'shape': None, 'kind': 'op', 'data_type': None},
     'conv_1_data': {'value': None, 'shape': None, 'kind': 'data'},
     'conv_2': {'type': 'Convolution', 'kind': 'op', 'op': 'Conv2D', 'layout': 'NHWC'},
     'conv_2_w': {'value': None, 'shape': None, 'kind': 'data'},
     'conv_2_b': {'value': None, 'shape': None, 'kind': 'data'},
+    'const_conv_2_w': {'value': None, 'shape': None, 'kind': 'op', 'data_type': None},
+    'const_conv_2_b': {'value': None, 'shape': None, 'kind': 'op', 'data_type': None},
     'conv_2_data': {'value': None, 'shape': None, 'kind': 'data'},
     # FullyConnected
     'fc_1': {'type': 'FullyConnected', 'kind': 'op', 'op': 'InnerProduct', 'layout': 'NHWC'},
     'fc_1_w': {'value': None, 'shape': None, 'kind': 'data'},
     'fc_1_b': {'value': None, 'shape': None, 'kind': 'data'},
+    'const_fc_1_w': {'value': None, 'shape': None, 'kind': 'op', 'data_type': None},
+    'const_fc_1_b': {'value': None, 'shape': None, 'kind': 'op', 'data_type': None},
     'fc_1_data': {'value': None, 'shape': None, 'kind': 'data'},
     # Placeholders
     'placeholder_2': {'shape': None, 'type': 'Placeholder', 'kind': 'op', 'op': 'Placeholder'},
     'placeholder_2_data': {'value': None, 'shape': None, 'kind': 'data', 'data_type': None},
     'placeholder_3': {'shape': None, 'type': 'Placeholder', 'kind': 'op', 'op': 'Placeholder'},
     'placeholder_3_data': {'value': None, 'shape': None, 'kind': 'data', 'data_type': None},
+    'op_output': {'kind': 'op', 'op': 'OpOutput'},
+    'op_output_1': {'kind': 'op', 'op': 'OpOutput'},
+    'op_output_2': {'kind': 'op', 'op': 'OpOutput'}
 }
 
 
@@ -78,37 +93,49 @@ class FuseMulTests(unittest.TestCase):
         graph = 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', 'conv_1'),
+                             ('const_conv_1_w', 'conv_1_w'),
+                             ('const_conv_1_b', 'conv_1_b'),
                              ('conv_1_w', 'conv_1'),
                              ('conv_1_b', 'conv_1'),
                              ('conv_1', 'conv_1_data'),
+                             ('conv_1_data', 'op_output')
                              ],
                             {'placeholder_1_data': {'shape': np.array([1, 227, 227, 3])},
                              'mul_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_conv_1_w': {'shape': np.array([11, 11, 3, 96]), 'value': np.ones((11, 11, 3, 96))},
                              'conv_1_w': {'shape': np.array([11, 11, 3, 96]), 'value': np.ones((11, 11, 3, 96)),
                                           'output_channel_dim': 3, 'input_channel_dim': 2,
                                           'dims_number': 4},
+                             'const_conv_1_b': {'shape': np.array([96]), 'value': np.zeros(96)},
                              'conv_1_b': {'shape': np.array([96]), 'value': np.zeros(96)},
-                             'conv_1_data': {'is_output': True}
+                             'conv_1_data': {}
                              })
         ref_weights = np.ones((11, 11, 3, 96)) * np.reshape(np.array([1, 2, 3]), (3, 1))
 
         graph_ref = build_graph(nodes_attributes,
                                 [('placeholder_1', 'placeholder_1_data'),
                                  ('placeholder_1_data', 'conv_1'),
+                                 ('const_conv_1_w', 'conv_1_w'),
+                                 ('const_conv_1_b', 'conv_1_b'),
                                  ('conv_1_w', 'conv_1'),
                                  ('conv_1_b', 'conv_1'),
                                  ('conv_1', 'conv_1_data'),
+                                 ('conv_1_data', 'op_output')
                                  ],
                                 {'placeholder_1_data': {'shape': np.array([1, 227, 227, 3])},
+                                 'const_conv_1_w': {'shape': ref_weights.shape, 'value': ref_weights},
                                  'conv_1_w': {'shape': ref_weights.shape, 'value': ref_weights,
                                               'output_channel_dim': 3, 'input_channel_dim': 2,
                                               'dims_number': 4},
+                                 'const_conv_1_b': {'shape': np.array([96]), 'value': np.zeros(96)},
                                  'conv_1_b': {'shape': np.array([96]), 'value': np.zeros(96)},
-                                 'conv_1_data': {'is_output': True}
+                                 'conv_1_data': {}
                                  })
 
         _fuse_mul(graph, Node(graph, 'mul_1'), [Node(graph, 'conv_1')], backward=False)
@@ -123,37 +150,49 @@ class FuseMulTests(unittest.TestCase):
         graph = 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', 'conv_1'),
+                             ('const_conv_1_w', 'conv_1_w'),
+                             ('const_conv_1_b', 'conv_1_b'),
                              ('conv_1_w', 'conv_1'),
                              ('conv_1_b', 'conv_1'),
                              ('conv_1', 'conv_1_data'),
+                             ('conv_1_data', 'op_output')
                              ],
                             {'placeholder_1_data': {'shape': np.array([1, 227, 227, 3])},
                              'mul_1_data': {'shape': np.array([1, 227, 227, 3])},
+                             'const_mul_1_w': {'shape': np.array([1]), 'value': 6},
                              'mul_1_w': {'shape': np.array([1]), 'value': 6},
+                             'const_conv_1_w': {'shape': np.array([11, 11, 3, 96]), 'value': np.ones((11, 11, 3, 96))},
                              'conv_1_w': {'shape': np.array([11, 11, 3, 96]), 'value': np.ones((11, 11, 3, 96)),
                                           'output_channel_dim': 3, 'input_channel_dim': 2,
                                           'dims_number': 4},
+                             'const_conv_1_b': {'shape': np.array([96]), 'value': np.zeros(96)},
                              'conv_1_b': {'shape': np.array([96]), 'value': np.zeros(96)},
-                             'conv_1_data': {'is_output': True}
+                             'conv_1_data': {}
                              })
         ref_weights = np.ones((11, 11, 3, 96)) * np.reshape(np.array([6, 6, 6]), (3, 1))
 
         graph_ref = build_graph(nodes_attributes,
                                 [('placeholder_1', 'placeholder_1_data'),
                                  ('placeholder_1_data', 'conv_1'),
+                                 ('const_conv_1_w', 'conv_1_w'),
+                                 ('const_conv_1_b', 'conv_1_b'),
                                  ('conv_1_w', 'conv_1'),
                                  ('conv_1_b', 'conv_1'),
                                  ('conv_1', 'conv_1_data'),
+                                 ('conv_1_data', 'op_output')
                                  ],
                                 {'placeholder_1_data': {'shape': np.array([1, 227, 227, 3])},
+                                 'const_conv_1_w': {'shape': ref_weights.shape, 'value': ref_weights},
                                  'conv_1_w': {'shape': ref_weights.shape, 'value': ref_weights,
                                               'output_channel_dim': 3, 'input_channel_dim': 2,
                                               'dims_number': 4},
+                                 'const_conv_1_b': {'shape': np.array([96]), 'value': np.zeros(96)},
                                  'conv_1_b': {'shape': np.array([96]), 'value': np.zeros(96)},
-                                 'conv_1_data': {'is_output': True}
+                                 'conv_1_data': {}
                                  })
 
         _fuse_mul(graph, Node(graph, 'mul_1'), [Node(graph, 'conv_1')], backward=False)
@@ -168,20 +207,27 @@ class FuseMulTests(unittest.TestCase):
         graph = build_graph(nodes_attributes,
                             [('placeholder_1', 'placeholder_1_data'),
                              ('placeholder_1_data', 'conv_1'),
+                             ('const_conv_1_w', 'conv_1_w'),
+                             ('const_conv_1_b', 'conv_1_b'),
                              ('conv_1_w', 'conv_1'),
                              ('conv_1_b', 'conv_1'),
                              ('conv_1', 'conv_1_data'),
                              ('conv_1_data', 'mul_1'),
+                             ('const_mul_1_w', 'mul_1_w'),
                              ('mul_1_w', 'mul_1'),
                              ('mul_1', 'mul_1_data'),
+                             ('mul_1_data', 'op_output')
                              ],
                             {'placeholder_1_data': {'shape': np.array([1, 227, 227, 3])},
+                             'const_conv_1_w': {'shape': np.array([11, 11, 3, 96]), 'value': np.ones((11, 11, 3, 96))},
                              'conv_1_w': {'shape': np.array([11, 11, 3, 96]), 'value': np.ones((11, 11, 3, 96)),
                                           'output_channel_dim': 3, 'input_channel_dim': 2,
                                           'dims_number': 4},
+                             'const_conv_1_b': {'shape': np.array([96]), 'value': np.ones(96)},
                              'conv_1_b': {'shape': np.array([96]), 'value': np.ones(96)},
                              'conv_1_data': {'shape': np.array([1, 55, 55, 96])},
-                             'mul_1_data': {'shape': np.array([1, 55, 55, 96]), 'is_output': True},
+                             'mul_1_data': {'shape': np.array([1, 55, 55, 96])},
+                             'const_mul_1_w': {'shape': np.array([96]), 'value': np.array([x for x in range(96)])},
                              'mul_1_w': {'shape': np.array([96]), 'value': np.array([x for x in range(96)])},
                              })
         ref_weights = np.ones((11, 11, 3, 96)) * np.reshape(np.array([x for x in range(96)]), 96)
@@ -190,16 +236,21 @@ class FuseMulTests(unittest.TestCase):
         graph_ref = build_graph(nodes_attributes,
                                 [('placeholder_1', 'placeholder_1_data'),
                                  ('placeholder_1_data', 'conv_1'),
+                                 ('const_conv_1_w', 'conv_1_w'),
+                                 ('const_conv_1_b', 'conv_1_b'),
                                  ('conv_1_w', 'conv_1'),
                                  ('conv_1_b', 'conv_1'),
                                  ('conv_1', 'conv_1_data'),
+                                 ('conv_1_data', 'op_output')
                                  ],
                                 {'placeholder_1_data': {'shape': np.array([1, 227, 227, 3])},
+                                 'const_conv_1_w': {'shape': ref_weights.shape, 'value': ref_weights},
                                  'conv_1_w': {'shape': ref_weights.shape, 'value': ref_weights,
                                               'output_channel_dim': 3, 'input_channel_dim': 2,
                                               'dims_number': 4},
+                                 'const_conv_1_b': {'shape': ref_biases.shape, 'value': ref_biases},
                                  'conv_1_b': {'shape': ref_biases.shape, 'value': ref_biases},
-                                 'conv_1_data': {'shape': np.array([1, 55, 55, 96]), 'is_output': True}
+                                 'conv_1_data': {'shape': np.array([1, 55, 55, 96])}
                                  })
 
         _fuse_mul(graph, Node(graph, 'mul_1'), [Node(graph, 'conv_1')], backward=True)
@@ -214,20 +265,27 @@ class FuseMulTests(unittest.TestCase):
         graph = build_graph(nodes_attributes,
                             [('placeholder_1', 'placeholder_1_data'),
                              ('placeholder_1_data', 'conv_1'),
+                             ('const_conv_1_w', 'conv_1_w'),
+                             ('const_conv_1_b', 'conv_1_b'),
                              ('conv_1_w', 'conv_1'),
                              ('conv_1_b', 'conv_1'),
                              ('conv_1', 'conv_1_data'),
                              ('conv_1_data', 'mul_1'),
+                             ('const_mul_1_w', 'mul_1_w'),
                              ('mul_1_w', 'mul_1'),
                              ('mul_1', 'mul_1_data'),
+                             ('mul_1_data', 'op_output')
                              ],
                             {'placeholder_1_data': {'shape': np.array([1, 227, 227, 3])},
+                             'const_conv_1_w': {'shape': np.array([11, 11, 3, 96]), 'value': np.ones((11, 11, 3, 96))},
                              'conv_1_w': {'shape': np.array([11, 11, 3, 96]), 'value': np.ones((11, 11, 3, 96)),
                                           'output_channel_dim': 3, 'input_channel_dim': 2,
                                           'dims_number': 4},
+                             'const_conv_1_b': {'shape': np.array([96]), 'value': np.ones(96)},
                              'conv_1_b': {'shape': np.array([96]), 'value': np.ones(96)},
                              'conv_1_data': {'shape': np.array([1, 55, 55, 96])},
-                             'mul_1_data': {'shape': np.array([1, 55, 55, 96]), 'is_output': True},
+                             'mul_1_data': {'shape': np.array([1, 55, 55, 96])},
+                             'const_mul_1_w': {'shape': np.array([1]), 'value': 6},
                              'mul_1_w': {'shape': np.array([1]), 'value': 6},
                              })
         ref_weights = np.ones((11, 11, 3, 96)) * np.array([6])
@@ -236,16 +294,21 @@ class FuseMulTests(unittest.TestCase):
         graph_ref = build_graph(nodes_attributes,
                                 [('placeholder_1', 'placeholder_1_data'),
                                  ('placeholder_1_data', 'conv_1'),
+                                 ('const_conv_1_w', 'conv_1_w'),
+                                 ('const_conv_1_b', 'conv_1_b'),
                                  ('conv_1_w', 'conv_1'),
                                  ('conv_1_b', 'conv_1'),
                                  ('conv_1', 'conv_1_data'),
+                                 ('conv_1_data', 'op_output')
                                  ],
                                 {'placeholder_1_data': {'shape': np.array([1, 227, 227, 3])},
+                                 'const_conv_1_w': {'shape': ref_weights.shape, 'value': ref_weights},
                                  'conv_1_w': {'shape': ref_weights.shape, 'value': ref_weights,
                                               'output_channel_dim': 3, 'input_channel_dim': 2,
                                               'dims_number': 4},
+                                 'const_conv_1_b': {'shape': ref_biases.shape, 'value': ref_biases},
                                  'conv_1_b': {'shape': ref_biases.shape, 'value': ref_biases},
-                                 'conv_1_data': {'shape': np.array([1, 55, 55, 96]), 'is_output': True}
+                                 'conv_1_data': {'shape': np.array([1, 55, 55, 96])}
                                  })
 
         _fuse_mul(graph, Node(graph, 'mul_1'), [Node(graph, 'conv_1')], backward=True)
@@ -262,9 +325,12 @@ class FuseMulTests(unittest.TestCase):
         graph = 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', 'conv_1'),
+                             ('const_conv_1_w', 'conv_1_w'),
+                             ('const_conv_1_b', 'conv_1_b'),
                              ('conv_1_w', 'conv_1'),
                              ('conv_1_b', 'conv_1'),
                              ('conv_1', 'conv_1_data'),
@@ -276,21 +342,28 @@ class FuseMulTests(unittest.TestCase):
                              ('placeholder_3_data', 'concat_1'),
                              ('conv_1_data', 'concat_1'),
                              ('concat_1', 'concat_1_data'),
+                             ('concat_1_data', 'op_output')
+
                              ],
                             {'placeholder_1_data': {'shape': np.array([1, 227, 227, 3])},
                              'mul_1_data': {'shape': np.array([1, 227, 227, 3])},
+                             'const_mul_1_w': {'shape': np.array([1]), 'value': 6},
                              'mul_1_w': {'shape': np.array([1]), 'value': 6},
+                             'const_conv_1_w': {'shape': np.array([11, 11, 3, 96]), 'value': np.ones((11, 11, 3, 96))},
                              'conv_1_w': {'shape': np.array([11, 11, 3, 96]), 'value': np.ones((11, 11, 3, 96)),
                                           'output_channel_dim': 3, 'input_channel_dim': 2,
                                           'dims_number': 4},
+                             'const_conv_1_b': {'shape': np.array([96]), 'value': np.zeros(96)},
                              'conv_1_b': {'shape': np.array([96]), 'value': np.zeros(96)},
-                             'concat_1_data': {'is_output': True}
+                             'concat_1_data': {}
                              })
         ref_weights = np.ones((11, 11, 3, 96)) * np.reshape(np.array([6, 6, 6]), (3, 1))
 
         graph_ref = build_graph(nodes_attributes,
                                 [('placeholder_1', 'placeholder_1_data'),
                                  ('placeholder_1_data', 'conv_1'),
+                                 ('const_conv_1_w', 'conv_1_w'),
+                                 ('const_conv_1_b', 'conv_1_b'),
                                  ('conv_1_w', 'conv_1'),
                                  ('conv_1_b', 'conv_1'),
                                  ('conv_1', 'conv_1_data'),
@@ -302,15 +375,18 @@ class FuseMulTests(unittest.TestCase):
                                  ('placeholder_3_data', 'concat_1'),
                                  ('conv_1_data', 'concat_1'),
                                  ('concat_1', 'concat_1_data'),
+                                 ('concat_1_data', 'op_output'),
                                  ],
                                 {'placeholder_1_data': {'shape': np.array([1, 227, 227, 3])},
+                                 'const_conv_1_w': {'shape': ref_weights.shape, 'value': ref_weights},
                                  'conv_1_w': {'shape': ref_weights.shape, 'value': ref_weights,
                                               'output_channel_dim': 3,
                                               'input_channel_dim': 2, 'dims_number': 4},
+                                 'const_conv_1_b': {'shape': np.array([96]), 'value': np.zeros(96)},
                                  'conv_1_b': {'shape': np.array([96]), 'value': np.zeros(96)},
-                                 'conv_1_data': {'is_output': True},
-                                 'placeholder_2_data': {'is_output': True},
-                                 'placeholder_3_data': {'is_output': True},
+                                 'conv_1_data': {},
+                                 'placeholder_2_data': {},
+                                 'placeholder_3_data': {},
                                  })
 
         _fuse_mul(graph, Node(graph, 'mul_1'), [Node(graph, 'conv_1')], backward=False)
@@ -323,9 +399,12 @@ class FuseMulTests(unittest.TestCase):
         graph = 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', 'conv_1'),
+                             ('const_conv_1_w', 'conv_1_w'),
+                             ('const_conv_1_b', 'conv_1_b'),
                              ('conv_1_w', 'conv_1'),
                              ('conv_1_b', 'conv_1'),
                              ('conv_1', 'conv_1_data'),
@@ -337,21 +416,28 @@ class FuseMulTests(unittest.TestCase):
                              ('placeholder_3_data', 'concat_1'),
                              ('conv_1_data', 'concat_1'),
                              ('concat_1', 'concat_1_data'),
+                             ('concat_1_data', 'op_output'),
+
                              ],
                             {'placeholder_1_data': {'shape': np.array([1, 227, 227, 3])},
                              'mul_1_data': {'shape': np.array([1, 227, 227, 3])},
+                             'const_mul_1_w': {'shape': np.array([1]), 'value': np.array([6])},
                              'mul_1_w': {'shape': np.array([1]), 'value': np.array([6])},
+                             'const_conv_1_w': {'shape': np.array([11, 11, 3, 96]), 'value': np.ones((11, 11, 3, 96))},
                              'conv_1_w': {'shape': np.array([11, 11, 3, 96]), 'value': np.ones((11, 11, 3, 96)),
                                           'output_channel_dim': 3, 'input_channel_dim': 2,
                                           'dims_number': 4},
+                             'const_conv_1_b': {'shape': np.array([96]), 'value': np.zeros(96)},
                              'conv_1_b': {'shape': np.array([96]), 'value': np.zeros(96)},
-                             'concat_1_data': {'is_output': True}
+                             'concat_1_data': {}
                              })
         ref_weights = np.ones((11, 11, 3, 96)) * np.reshape(np.array([6, 6, 6]), (3, 1))
 
         graph_ref = build_graph(nodes_attributes,
                                 [('placeholder_1', 'placeholder_1_data'),
                                  ('placeholder_1_data', 'conv_1'),
+                                 ('const_conv_1_w', 'conv_1_w'),
+                                 ('const_conv_1_b', 'conv_1_b'),
                                  ('conv_1_w', 'conv_1'),
                                  ('conv_1_b', 'conv_1'),
                                  ('conv_1', 'conv_1_data'),
@@ -363,15 +449,18 @@ class FuseMulTests(unittest.TestCase):
                                  ('placeholder_3_data', 'concat_1'),
                                  ('conv_1_data', 'concat_1'),
                                  ('concat_1', 'concat_1_data'),
+                                 ('concat_1_data', 'op_output'),
                                  ],
                                 {'placeholder_1_data': {'shape': np.array([1, 227, 227, 3])},
+                                 'const_conv_1_w': {'shape': ref_weights.shape, 'value': ref_weights},
                                  'conv_1_w': {'shape': ref_weights.shape, 'value': ref_weights,
                                               'output_channel_dim': 3,
                                               'input_channel_dim': 2, 'dims_number': 4},
+                                 'const_conv_1_b': {'shape': np.array([96]), 'value': np.zeros(96)},
                                  'conv_1_b': {'shape': np.array([96]), 'value': np.zeros(96)},
-                                 'conv_1_data': {'is_output': True},
-                                 'placeholder_2_data': {'is_output': True},
-                                 'placeholder_3_data': {'is_output': True},
+                                 'conv_1_data': {},
+                                 'placeholder_2_data': {},
+                                 'placeholder_3_data': {},
                                  })
 
         _fuse_mul(graph, Node(graph, 'mul_1'), [Node(graph, 'conv_1')], backward=False)
@@ -387,60 +476,80 @@ class FuseMulTests(unittest.TestCase):
         graph = 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', 'conv_1'),
+                             ('const_conv_1_w', 'conv_1_w'),
+                             ('const_conv_1_b', 'conv_1_b'),
                              ('conv_1_w', 'conv_1'),
                              ('conv_1_b', 'conv_1'),
                              ('conv_1', 'conv_1_data'),
                              ('mul_1_data', 'conv_2'),
+                             ('const_conv_2_w', 'conv_2_w'),
+                             ('const_conv_2_b', 'conv_2_b'),
                              ('conv_2_w', 'conv_2'),
                              ('conv_2_b', 'conv_2'),
                              ('conv_2', 'conv_2_data'),
                              ('conv_1_data', 'concat_1'),
                              ('conv_2_data', 'concat_1'),
-                             ('concat_1', 'concat_1_data')
+                             ('concat_1', 'concat_1_data'),
+                             ('concat_1_data', 'op_output')
                              ],
                             {'placeholder_1_data': {'shape': np.array([1, 227, 227, 3])},
                              'mul_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_conv_1_w': {'shape': np.array([11, 11, 3, 96]), 'value': np.ones((11, 11, 3, 96))},
                              'conv_1_w': {'shape': np.array([11, 11, 3, 96]), 'value': np.ones((11, 11, 3, 96)),
                                           'output_channel_dim': 3, 'input_channel_dim': 2,
                                           'dims_number': 4},
+                             'const_conv_1_b': {'shape': np.array([96]), 'value': np.zeros(96)},
                              'conv_1_b': {'shape': np.array([96]), 'value': np.zeros(96)},
                              'conv_1_data': {'shape': np.array([1, 55, 55, 96])},
+                             'const_conv_2_w': {'shape': np.array([11, 11, 3, 96]), 'value': np.ones((11, 11, 3, 96))},
                              'conv_2_w': {'shape': np.array([11, 11, 3, 96]), 'value': np.ones((11, 11, 3, 96)),
                                           'output_channel_dim': 3, 'input_channel_dim': 2,
                                           'dims_number': 4},
+                             'const_conv_2_b': {'shape': np.array([96]), 'value': np.zeros(96)},
                              'conv_2_b': {'shape': np.array([96]), 'value': np.zeros(96)},
                              'conv_2_data': {'shape': np.array([1, 55, 55, 96])},
-                             'concat_1_data': {'is_output': True}
+                             'concat_1_data': {}
                              })
         ref_weights = np.ones((11, 11, 3, 96)) * np.reshape(np.array([1, 2, 3]), (3, 1))
 
         graph_ref = build_graph(nodes_attributes,
                                 [('placeholder_1', 'placeholder_1_data'),
                                  ('placeholder_1_data', 'conv_1'),
+                                 ('const_conv_1_w', 'conv_1_w'),
+                                 ('const_conv_1_b', 'conv_1_b'),
                                  ('conv_1_w', 'conv_1'),
                                  ('conv_1_b', 'conv_1'),
                                  ('conv_1', 'conv_1_data'),
                                  ('placeholder_1_data', 'conv_2'),
+                                 ('const_conv_2_w', 'conv_2_w'),
+                                 ('const_conv_2_b', 'conv_2_b'),
                                  ('conv_2_w', 'conv_2'),
                                  ('conv_2_b', 'conv_2'),
                                  ('conv_2', 'conv_2_data'),
                                  ('conv_1_data', 'concat_1'),
                                  ('conv_2_data', 'concat_1'),
-                                 ('concat_1', 'concat_1_data')
+                                 ('concat_1', 'concat_1_data'),
+                                 ('concat_1_data', 'op_output')
                                  ],
                                 {'placeholder_1_data': {'shape': np.array([1, 227, 227, 3])},
+                                 'const_conv_1_w': {'shape': ref_weights.shape, 'value': ref_weights},
                                  'conv_1_w': {'shape': ref_weights.shape, 'value': ref_weights,
                                               'output_channel_dim': 3, 'input_channel_dim': 2,
                                               'dims_number': 4},
+                                 'const_conv_1_b': {'shape': np.array([96]), 'value': np.zeros(96)},
                                  'conv_1_b': {'shape': np.array([96]), 'value': np.zeros(96)},
                                  'conv_1_data': {'shape': np.array([1, 55, 55, 96])},
+                                 'const_conv_2_w': {'shape': ref_weights.shape, 'value': ref_weights},
                                  'conv_2_w': {'shape': ref_weights.shape, 'value': ref_weights,
                                               'output_channel_dim': 3, 'input_channel_dim': 2,
                                               'dims_number': 4},
+                                 'const_conv_2_b': {'shape': np.array([96]), 'value': np.zeros(96)},
                                  'conv_2_b': {'shape': np.array([96]), 'value': np.zeros(96)},
                                  'conv_2_data': {'shape': np.array([1, 55, 55, 96])},
                                  })
@@ -457,37 +566,50 @@ class FuseMulTests(unittest.TestCase):
         graph = 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', 'fc_1'),
+                             ('const_fc_1_w', 'fc_1_w'),
+                             ('const_fc_1_b', 'fc_1_b'),
                              ('fc_1_w', 'fc_1'),
                              ('fc_1_b', 'fc_1'),
                              ('fc_1', 'fc_1_data'),
+                             ('fc_1_data', 'op_output')
                              ],
                             {'placeholder_1_data': {'shape': np.array([1, 2048])},
                              'mul_1_data': {'shape': np.array([1, 2048])},
+                             'const_mul_1_w': {'shape': np.array([2048]), 'value': np.array([x for x in range(2048)])},
                              'mul_1_w': {'shape': np.array([2048]), 'value': np.array([x for x in range(2048)])},
+                             'const_fc_1_w': {'shape': np.array([10260, 2048]), 'value': np.ones((10260, 2048))},
                              'fc_1_w': {'shape': np.array([10260, 2048]), 'value': np.ones((10260, 2048)),
                                         'output_channel_dim': 0, 'input_channel_dim': 1,
                                         'dims_number': 2},
+                             'const_fc_1_b': {'shape': np.array([10260]), 'value': np.ones(10260)},
                              'fc_1_b': {'shape': np.array([10260]), 'value': np.ones(10260)},
-                             'fc_1_data': {'shape': np.array([1, 10260]), 'is_output': True},
+                             'fc_1_data': {'shape': np.array([1, 10260])},
                              })
         ref_weights = np.ones((10260, 2048)) * np.array([x for x in range(2048)])
 
         graph_ref = build_graph(nodes_attributes,
                                 [('placeholder_1', 'placeholder_1_data'),
                                  ('placeholder_1_data', 'fc_1'),
+                                 ('const_fc_1_w', 'fc_1_w'),
+                                 ('const_fc_1_b', 'fc_1_b'),
                                  ('fc_1_w', 'fc_1'),
                                  ('fc_1_b', 'fc_1'),
                                  ('fc_1', 'fc_1_data'),
+                                 ('fc_1_data', 'op_output')
+
                                  ],
                                 {'placeholder_1_data': {'shape': np.array([1, 2048])},
+                                 'const_fc_1_w': {'shape': ref_weights.shape, 'value': ref_weights},
                                  'fc_1_w': {'shape': ref_weights.shape, 'value': ref_weights,
                                             'output_channel_dim': 0, 'input_channel_dim': 1,
                                             'dims_number': 2},
+                                 'const_fc_1_b': {'shape': np.array([10260]), 'value': np.ones(10260)},
                                  'fc_1_b': {'shape': np.array([10260]), 'value': np.ones(10260)},
-                                 'fc_1_data': {'shape': np.array([1, 10260]), 'is_output': True},
+                                 'fc_1_data': {'shape': np.array([1, 10260])},
                                  })
 
         _fuse_mul(graph, Node(graph, 'mul_1'), [Node(graph, 'fc_1')], backward=False)
@@ -502,43 +624,57 @@ class FuseMulTests(unittest.TestCase):
         graph = 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', 'conv_1'),
+                             ('const_conv_1_w', 'conv_1_w'),
+                             ('const_conv_1_b', 'conv_1_b'),
                              ('conv_1_w', 'conv_1'),
                              ('conv_1_b', 'conv_1'),
                              ('conv_1', 'conv_1_data'),
+                             ('conv_1_data', 'op_output')
                              ],
                             {'placeholder_1_data': {'shape': np.array([1, 227, 227, 3])},
                              'mul_1_data': {'shape': np.array([1, 227, 227, 3])},
-                             'mul_1_w': {'shape': np.array([1]), 'value': 6},
+                             'const_mul_1_w': {'shape': np.array([]), 'value': np.array(6)},
+                             'mul_1_w': {'shape': np.array([]), 'value': np.array(6)},
                              'conv_1': {'can_be_fused': False},
+                             'const_conv_1_w': {'shape': np.array([11, 11, 3, 96]), 'value': np.ones((11, 11, 3, 96))},
                              'conv_1_w': {'shape': np.array([11, 11, 3, 96]), 'value': np.ones((11, 11, 3, 96)),
                                           'output_channel_dim': 3, 'input_channel_dim': 2,
                                           'dims_number': 4},
+                             'const_conv_1_b': {'shape': np.array([96]), 'value': np.zeros(96)},
                              'conv_1_b': {'shape': np.array([96]), 'value': np.zeros(96)},
-                             'conv_1_data': {'is_output': True}
+                             'conv_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', 'conv_1'),
+                                 ('const_conv_1_w', 'conv_1_w'),
+                                 ('const_conv_1_b', 'conv_1_b'),
                                  ('conv_1_w', 'conv_1'),
                                  ('conv_1_b', 'conv_1'),
                                  ('conv_1', 'conv_1_data'),
+                                 ('conv_1_data', 'op_output')
                                  ],
                                 {'placeholder_1_data': {'shape': np.array([1, 227, 227, 3])},
                                  'mul_1_data': {'shape': np.array([1, 227, 227, 3])},
-                                 'mul_1_w': {'shape': np.array([1]), 'value': 6},
+                                 'const_mul_1_w': {'shape': np.array([]), 'value': np.array(6)},
+                                 'mul_1_w': {'shape': np.array([]), 'value': np.array(6)},
                                  'conv_1': {'can_be_fused': False},
+                                 'const_conv_1_w': {'shape': np.array([11, 11, 3, 96]), 'value': np.ones((11, 11, 3, 96))},
                                  'conv_1_w': {'shape': np.array([11, 11, 3, 96]), 'value': np.ones((11, 11, 3, 96)),
                                               'output_channel_dim': 3, 'input_channel_dim': 2,
                                               'dims_number': 4},
+                                 'const_conv_1_b': {'shape': np.array([96]), 'value': np.zeros(96)},
                                  'conv_1_b': {'shape': np.array([96]), 'value': np.zeros(96)},
-                                 'conv_1_data': {'is_output': True}
+                                 'conv_1_data': {}
                                  })
 
         _fuse_mul(graph, Node(graph, 'mul_1'), [Node(graph, 'conv_1')], backward=False)
@@ -553,33 +689,41 @@ class FuseMulTests(unittest.TestCase):
         graph = 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', 'conv_1'),
+                             ('const_conv_1_w', 'conv_1_w'),
                              ('conv_1_w', 'conv_1'),
                              ('conv_1', 'conv_1_data'),
+                             ('conv_1_data', 'op_output')
                              ],
                             {'placeholder_1_data': {'shape': np.array([1, 112, 112, 6])},
                              'mul_1_data': {'shape': np.array([1, 112, 112, 6])},
+                             'const_mul_1_w': {'shape': np.array([6]), 'value': np.array([1, 2, 3, 4, 5, 6])},
                              'mul_1_w': {'shape': np.array([6]), 'value': np.array([1, 2, 3, 4, 5, 6])},
+                             'const_conv_1_w': {'shape': np.array([3, 3, 6, 1]), 'value': np.ones((3, 3, 6, 1))},
                              'conv_1_w': {'shape': np.array([3, 3, 6, 1]), 'value': np.ones((3, 3, 6, 1)),
                                           'output_channel_dim': 2, 'input_channel_dim': 2,
                                           'dims_number': 4},
-                             'conv_1_data': {'is_output': True}
+                             'conv_1_data': {}
                              })
         ref_weights = np.ones((3, 3, 6, 1)) * np.reshape(np.array([1, 2, 3, 4, 5, 6]), (6, 1))
 
         graph_ref = build_graph(nodes_attributes,
                                 [('placeholder_1', 'placeholder_1_data'),
                                  ('placeholder_1_data', 'conv_1'),
+                                 ('const_conv_1_w', 'conv_1_w'),
                                  ('conv_1_w', 'conv_1'),
                                  ('conv_1', 'conv_1_data'),
+                                 ('conv_1_data', 'op_output')
                                  ],
                                 {'placeholder_1_data': {'shape': np.array([1, 112, 112, 6])},
+                                 'const_conv_1_w': {'shape': ref_weights.shape, 'value': ref_weights},
                                  'conv_1_w': {'shape': ref_weights.shape, 'value': ref_weights,
                                               'output_channel_dim': 2, 'input_channel_dim': 2,
                                               'dims_number': 4},
-                                 'conv_1_data': {'is_output': True}
+                                 'conv_1_data': {}
                                  })
 
         _fuse_mul(graph, Node(graph, 'mul_1'), [Node(graph, 'conv_1')], backward=False)
@@ -594,19 +738,24 @@ class FuseMulTests(unittest.TestCase):
         graph = build_graph(nodes_attributes,
                             [('placeholder_1', 'placeholder_1_data'),
                              ('placeholder_1_data', 'conv_1'),
+                             ('const_conv_1_w', 'conv_1_w'),
                              ('conv_1_w', 'conv_1'),
                              ('conv_1', 'conv_1_data'),
                              ('conv_1_data', 'mul_1'),
+                             ('const_mul_1_w', 'mul_1_w'),
                              ('mul_1_w', 'mul_1'),
                              ('mul_1', 'mul_1_data'),
+                             ('mul_1_data', 'op_output')
                              ],
                             {'placeholder_1_data': {'shape': np.array([1, 112, 112, 6])},
-                             'mul_1_data': {'shape': np.array([1, 112, 112, 6]), 'is_output': True},
+                             'mul_1_data': {'shape': np.array([1, 112, 112, 6])},
+                             'const_mul_1_w': {'shape': np.array([6]), 'value': np.array([1, 2, 3, 4, 5, 6])},
                              'mul_1_w': {'shape': np.array([6]), 'value': np.array([1, 2, 3, 4, 5, 6])},
+                             'const_conv_1_w': {'shape': np.array([3, 3, 6, 1]), 'value': np.ones((3, 3, 6, 1))},
                              'conv_1_w': {'shape': np.array([3, 3, 6, 1]), 'value': np.ones((3, 3, 6, 1)),
                                           'output_channel_dim': 2, 'input_channel_dim': 2,
                                           'dims_number': 4},
-                             'conv_1_data': {'is_output': True}
+                             'conv_1_data': {}
                              })
 
         ref_weights = np.ones((3, 3, 6, 1)) * np.reshape(np.array([1, 2, 3, 4, 5, 6]), (6, 1))
@@ -614,10 +763,13 @@ class FuseMulTests(unittest.TestCase):
         graph_ref = build_graph(nodes_attributes,
                                 [('placeholder_1', 'placeholder_1_data'),
                                  ('placeholder_1_data', 'conv_1'),
+                                 ('const_conv_1_w', 'conv_1_w'),
                                  ('conv_1_w', 'conv_1'),
                                  ('conv_1', 'conv_1_data'),
+                                 ('conv_1_data', 'op_output')
                                  ],
                                 {'placeholder_1_data': {'shape': np.array([1, 112, 112, 6])},
+                                 'const_conv_1_w': {'shape': ref_weights.shape, 'value': ref_weights},
                                  'conv_1_w': {'shape': ref_weights.shape, 'value': ref_weights,
                                               'output_channel_dim': 2, 'input_channel_dim': 2,
                                               'dims_number': 4},
@@ -638,21 +790,29 @@ class FuseAddTests(unittest.TestCase):
         graph = build_graph(nodes_attributes,
                             [('placeholder_1', 'placeholder_1_data'),
                              ('placeholder_1_data', 'add_1'),
+                             ('const_add_1_w', 'add_1_w'),
                              ('add_1_w', 'add_1'),
                              ('add_1', 'add_1_data'),
                              ('add_1_data', 'fc_1'),
+                             ('const_fc_1_w', 'fc_1_w'),
+                             ('const_fc_1_b', 'fc_1_b'),
                              ('fc_1_w', 'fc_1'),
                              ('fc_1_b', 'fc_1'),
                              ('fc_1', 'fc_1_data'),
+                             ('fc_1_data', 'op_output')
+
                              ],
                             {'placeholder_1_data': {'shape': np.array([1, 2048])},
                              'add_1_data': {'shape': np.array([1, 2048])},
+                             'const_add_1_w': {'shape': np.array([2048]), 'value': np.array([x for x in range(2048)])},
                              'add_1_w': {'shape': np.array([2048]), 'value': np.array([x for x in range(2048)])},
+                             'const_fc_1_w': {'shape': np.array([10260, 2048]), 'value': np.ones((10260, 2048))},
                              'fc_1_w': {'shape': np.array([10260, 2048]), 'value': np.ones((10260, 2048)),
                                         'output_channel_dim': 0, 'input_channel_dim': 1,
                                         'dims_number': 2},
+                             'const_fc_1_b': {'shape': np.array([10260]), 'value': np.ones(10260)},
                              'fc_1_b': {'shape': np.array([10260]), 'value': np.ones(10260)},
-                             'fc_1_data': {'shape': np.array([1, 10260]), 'is_output': True},
+                             'fc_1_data': {'shape': np.array([1, 10260])},
                              })
         ref_weights = np.ones((10260, 2048))
         ref_biases = np.ones(10260) + np.dot(np.ones((10260, 2048)), np.array([x for x in range(2048)]))
@@ -660,16 +820,21 @@ class FuseAddTests(unittest.TestCase):
         graph_ref = build_graph(nodes_attributes,
                                 [('placeholder_1', 'placeholder_1_data'),
                                  ('placeholder_1_data', 'fc_1'),
+                                 ('const_fc_1_w', 'fc_1_w'),
+                                 ('const_fc_1_b', 'fc_1_b'),
                                  ('fc_1_w', 'fc_1'),
                                  ('fc_1_b', 'fc_1'),
                                  ('fc_1', 'fc_1_data'),
+                                 ('fc_1_data', 'op_output')
                                  ],
                                 {'placeholder_1_data': {'shape': np.array([1, 2048])},
+                                 'const_fc_1_w': {'shape': ref_weights.shape, 'value': ref_weights},
                                  'fc_1_w': {'shape': ref_weights.shape, 'value': ref_weights,
                                             'output_channel_dim': 0, 'input_channel_dim': 1,
                                             'dims_number': 2},
+                                 'const_fc_1_b': {'shape': ref_biases.shape, 'value': ref_biases},
                                  'fc_1_b': {'shape': ref_biases.shape, 'value': ref_biases},
-                                 'fc_1_data': {'shape': np.array([1, 10260]), 'is_output': True},
+                                 'fc_1_data': {'shape': np.array([1, 10260])},
                                  })
 
         _fuse_add(graph, Node(graph, 'add_1'), [Node(graph, 'fc_1')], backward=False)
@@ -684,16 +849,21 @@ class FuseAddTests(unittest.TestCase):
         graph = build_graph(nodes_attributes,
                             [('placeholder_1', 'placeholder_1_data'),
                              ('placeholder_1_data', 'fc_1'),
+                             ('const_fc_1_w', 'fc_1_w'),
                              ('fc_1_w', 'fc_1'),
                              ('fc_1', 'fc_1_data'),
                              ('fc_1_data', 'add_1'),
+                             ('const_add_1_w', 'add_1_w'),
                              ('add_1_w', 'add_1'),
                              ('add_1', 'add_1_data'),
+                             ('add_1_data', 'op_output_1')
                              ],
                             {'placeholder_1_data': {'shape': np.array([1, 2048])},
-                             'add_1_data': {'shape': np.array([1, 10260]), 'is_output': True},
+                             'add_1_data': {'shape': np.array([1, 10260])},
+                             'const_add_1_w': {'shape': np.array([10260]), 'value': np.array([x for x in range(10260)])},
                              'add_1_w': {'shape': np.array([10260]), 'value': np.array([x for x in range(10260)]),
                                          'data_type': None},
+                             'const_fc_1_w': {'shape': np.array([10260, 2048]), 'value': np.ones((10260, 2048))},
                              'fc_1_w': {'shape': np.array([10260, 2048]), 'value': np.ones((10260, 2048)),
                                         'output_channel_dim': 0, 'input_channel_dim': 1,
                                         'dims_number': 2, 'data_type': None},
@@ -706,16 +876,21 @@ class FuseAddTests(unittest.TestCase):
         graph_ref = build_graph(nodes_attributes,
                                 [('placeholder_1', 'placeholder_1_data'),
                                  ('placeholder_1_data', 'fc_1'),
+                                 ('const_fc_1_w', 'fc_1_w'),
+                                 ('const_fc_1_b', 'fc_1_b'),
                                  ('fc_1_w', 'fc_1'),
                                  ('fc_1_b', 'fc_1'),
                                  ('fc_1', 'fc_1_data'),
+                                 ('fc_1_data', 'op_output')
                                  ],
                                 {'placeholder_1_data': {'shape': np.array([1, 2048])},
+                                 'const_fc_1_w': {'shape': ref_weights.shape, 'value': ref_weights},
                                  'fc_1_w': {'shape': ref_weights.shape, 'value': ref_weights,
                                             'output_channel_dim': 0, 'input_channel_dim': 1,
                                             'dims_number': 2},
+                                 'const_fc_1_b': {'shape': ref_biases.shape, 'value': ref_biases},
                                  'fc_1_b': {'shape': ref_biases.shape, 'value': ref_biases},
-                                 'fc_1_data': {'shape': np.array([1, 10260]), 'is_output': True},
+                                 'fc_1_data': {'shape': np.array([1, 10260])},
                                  })
 
         _fuse_add(graph, Node(graph, 'add_1'), [Node(graph, 'fc_1')], backward=True)
@@ -730,15 +905,20 @@ class FuseAddTests(unittest.TestCase):
         graph = build_graph(nodes_attributes,
                             [('placeholder_1', 'placeholder_1_data'),
                              ('placeholder_1_data', 'fc_1'),
+                             ('const_fc_1_w', 'fc_1_w'),
                              ('fc_1_w', 'fc_1'),
                              ('fc_1', 'fc_1_data'),
                              ('fc_1_data', 'add_1'),
+                             ('const_add_1_w', 'add_1_w'),
                              ('add_1_w', 'add_1'),
                              ('add_1', 'add_1_data'),
+                             ('add_1_data', 'op_output')
                              ],
                             {'placeholder_1_data': {'shape': np.array([1, 2048])},
-                             'add_1_data': {'shape': np.array([1, 10260]), 'is_output': True},
+                             'add_1_data': {'shape': np.array([1, 10260])},
+                             'const_add_1_w': {'shape': np.array([1]), 'value': 6, 'data_type': None},
                              'add_1_w': {'shape': np.array([1]), 'value': 6, 'data_type': None},
+                             'const_fc_1_w': {'shape': np.array([10260, 2048]), 'value': np.ones((10260, 2048))},
                              'fc_1_w': {'shape': np.array([10260, 2048]), 'value': np.ones((10260, 2048)),
                                         'output_channel_dim': 0, 'input_channel_dim': 1,
                                         'dims_number': 2, 'data_type': None},
@@ -751,16 +931,22 @@ class FuseAddTests(unittest.TestCase):
         graph_ref = build_graph(nodes_attributes,
                                 [('placeholder_1', 'placeholder_1_data'),
                                  ('placeholder_1_data', 'fc_1'),
+                                 ('const_fc_1_w', 'fc_1_w'),
+                                 ('const_fc_1_b', 'fc_1_b'),
                                  ('fc_1_w', 'fc_1'),
                                  ('fc_1_b', 'fc_1'),
                                  ('fc_1', 'fc_1_data'),
+                                 ('fc_1_data', 'op_output')
+
                                  ],
                                 {'placeholder_1_data': {'shape': np.array([1, 2048])},
+                                 'const_fc_1_w': {'shape': ref_weights.shape, 'value': ref_weights},
                                  'fc_1_w': {'shape': ref_weights.shape, 'value': ref_weights,
                                             'output_channel_dim': 0, 'input_channel_dim': 1,
                                             'dims_number': 2},
+                                 'const_fc_1_b': {'shape': ref_biases.shape, 'value': ref_biases},
                                  'fc_1_b': {'shape': ref_biases.shape, 'value': ref_biases},
-                                 'fc_1_data': {'shape': np.array([1, 10260]), 'is_output': True},
+                                 'fc_1_data': {'shape': np.array([1, 10260])},
                                  })
 
         _fuse_add(graph, Node(graph, 'add_1'), [Node(graph, 'fc_1')], backward=True)
@@ -775,43 +961,58 @@ class FuseAddTests(unittest.TestCase):
         graph = build_graph(nodes_attributes,
                             [('placeholder_1', 'placeholder_1_data'),
                              ('placeholder_1_data', 'add_1'),
+                             ('const_add_1_w', 'add_1_w'),
                              ('add_1_w', 'add_1'),
                              ('add_1', 'add_1_data'),
                              ('add_1_data', 'fc_1'),
+                             ('const_fc_1_w', 'fc_1_w'),
+                             ('const_fc_1_b', 'fc_1_b'),
                              ('fc_1_w', 'fc_1'),
                              ('fc_1_b', 'fc_1'),
                              ('fc_1', 'fc_1_data'),
+                             ('fc_1_data', 'op_output')
+
                              ],
                             {'placeholder_1_data': {'shape': np.array([1, 2048])},
                              'add_1_data': {'shape': np.array([1, 2048])},
+                             'const_add_1_w': {'shape': np.array([2048]), 'value': np.array([x for x in range(2048)])},
                              'add_1_w': {'shape': np.array([2048]), 'value': np.array([x for x in range(2048)])},
                              'fc_1': {'can_be_fused': False},
+                             'const_fc_1_w': {'shape': np.array([10260, 2048]), 'value': np.ones((10260, 2048))},
                              'fc_1_w': {'shape': np.array([10260, 2048]), 'value': np.ones((10260, 2048)),
                                         'output_channel_dim': 0, 'input_channel_dim': 1,
                                         'dims_number': 2},
+                             'const_fc_1_b': {'shape': np.array([10260]), 'value': np.ones(10260)},
                              'fc_1_b': {'shape': np.array([10260]), 'value': np.ones(10260)},
-                             'fc_1_data': {'shape': np.array([1, 10260]), 'is_output': True},
+                             'fc_1_data': {'shape': np.array([1, 10260])},
                              })
 
         graph_ref = build_graph(nodes_attributes,
                                 [('placeholder_1', 'placeholder_1_data'),
                                  ('placeholder_1_data', 'add_1'),
+                                 ('const_add_1_w', 'add_1_w'),
                                  ('add_1_w', 'add_1'),
                                  ('add_1', 'add_1_data'),
                                  ('add_1_data', 'fc_1'),
+                                 ('const_fc_1_w', 'fc_1_w'),
+                                 ('const_fc_1_b', 'fc_1_b'),
                                  ('fc_1_w', 'fc_1'),
                                  ('fc_1_b', 'fc_1'),
                                  ('fc_1', 'fc_1_data'),
+                                 ('fc_1_data', 'op_output')
                                  ],
                                 {'placeholder_1_data': {'shape': np.array([1, 2048])},
                                  'add_1_data': {'shape': np.array([1, 2048])},
+                                 'const_add_1_w': {'shape': np.array([2048]), 'value': np.array([x for x in range(2048)])},
                                  'add_1_w': {'shape': np.array([2048]), 'value': np.array([x for x in range(2048)])},
                                  'fc_1': {'can_be_fused': False},
+                                 'const_fc_1_w': {'shape': np.array([10260, 2048]), 'value': np.ones((10260, 2048))},
                                  'fc_1_w': {'shape': np.array([10260, 2048]), 'value': np.ones((10260, 2048)),
                                             'output_channel_dim': 0, 'input_channel_dim': 1,
                                             'dims_number': 2},
+                                 'const_fc_1_b': {'shape': np.array([10260]), 'value': np.ones(10260)},
                                  'fc_1_b': {'shape': np.array([10260]), 'value': np.ones(10260)},
-                                 'fc_1_data': {'shape': np.array([1, 10260]), 'is_output': True},
+                                 'fc_1_data': {'shape': np.array([1, 10260])},
                                  })
 
         _fuse_add(graph, Node(graph, 'add_1'), [Node(graph, 'fc_1')], backward=False)
@@ -830,60 +1031,80 @@ class FuseLinOpsTests(unittest.TestCase):
         graph = 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', 'conv_1'),
+                             ('const_conv_1_w', 'conv_1_w'),
+                             ('const_conv_1_b', 'conv_1_b'),
                              ('conv_1_w', 'conv_1'),
                              ('conv_1_b', 'conv_1'),
                              ('conv_1', 'conv_1_data'),
                              ('mul_1_data', 'conv_2'),
+                             ('const_conv_2_w', 'conv_2_w'),
+                             ('const_conv_2_b', 'conv_2_b'),
                              ('conv_2_w', 'conv_2'),
                              ('conv_2_b', 'conv_2'),
                              ('conv_2', 'conv_2_data'),
                              ('conv_1_data', 'concat_1'),
                              ('conv_2_data', 'concat_1'),
-                             ('concat_1', 'concat_1_data')
+                             ('concat_1', 'concat_1_data'),
+                             ('concat_1_data', 'op_output')
                              ],
                             {'placeholder_1_data': {'shape': np.array([1, 227, 227, 3])},
                              'mul_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_conv_1_w': {'shape': np.array([11, 11, 3, 96]), 'value': np.ones((11, 11, 3, 96))},
                              'conv_1_w': {'shape': np.array([11, 11, 3, 96]), 'value': np.ones((11, 11, 3, 96)),
                                           'output_channel_dim': 3, 'input_channel_dim': 2,
                                           'dims_number': 4},
+                             'const_conv_1_b': {'shape': np.array([96]), 'value': np.zeros(96)},
                              'conv_1_b': {'shape': np.array([96]), 'value': np.zeros(96)},
                              'conv_1_data': {'shape': np.array([1, 55, 55, 96])},
+                             'const_conv_2_w': {'shape': np.array([11, 11, 3, 96]), 'value': np.ones((11, 11, 3, 96))},
                              'conv_2_w': {'shape': np.array([11, 11, 3, 96]), 'value': np.ones((11, 11, 3, 96)),
                                           'output_channel_dim': 3, 'input_channel_dim': 2,
                                           'dims_number': 4},
+                             'const_conv_2_b': {'shape': np.array([96]), 'value': np.zeros(96)},
                              'conv_2_b': {'shape': np.array([96]), 'value': np.zeros(96)},
                              'conv_2_data': {'shape': np.array([1, 55, 55, 96])},
-                             'concat_1_data': {'is_output': True}
+                             'concat_1_data': {}
                              })
         ref_weights = np.ones((11, 11, 3, 96)) * np.reshape(np.array([1, 2, 3]), (3, 1))
 
         graph_ref = build_graph(nodes_attributes,
                                 [('placeholder_1', 'placeholder_1_data'),
                                  ('placeholder_1_data', 'conv_1'),
+                                 ('const_conv_1_w', 'conv_1_w'),
+                                 ('const_conv_1_b', 'conv_1_b'),
                                  ('conv_1_w', 'conv_1'),
                                  ('conv_1_b', 'conv_1'),
                                  ('conv_1', 'conv_1_data'),
                                  ('placeholder_1_data', 'conv_2'),
+                                 ('const_conv_2_w', 'conv_2_w'),
+                                 ('const_conv_2_b', 'conv_2_b'),
                                  ('conv_2_w', 'conv_2'),
                                  ('conv_2_b', 'conv_2'),
                                  ('conv_2', 'conv_2_data'),
                                  ('conv_1_data', 'concat_1'),
                                  ('conv_2_data', 'concat_1'),
-                                 ('concat_1', 'concat_1_data')
+                                 ('concat_1', 'concat_1_data'),
+                                 ('concat_1_data', 'op_output')
                                  ],
                                 {'placeholder_1_data': {'shape': np.array([1, 227, 227, 3])},
+                                 'const_conv_1_w': {'shape': ref_weights.shape, 'value': ref_weights},
                                  'conv_1_w': {'shape': ref_weights.shape, 'value': ref_weights,
                                               'output_channel_dim': 3, 'input_channel_dim': 2,
                                               'dims_number': 4},
+                                 'const_conv_1_b': {'shape': np.array([96]), 'value': np.zeros(96)},
                                  'conv_1_b': {'shape': np.array([96]), 'value': np.zeros(96)},
                                  'conv_1_data': {'shape': np.array([1, 55, 55, 96])},
+                                 'const_conv_2_w': {'shape': ref_weights.shape, 'value': ref_weights},
                                  'conv_2_w': {'shape': ref_weights.shape, 'value': ref_weights,
                                               'output_channel_dim': 3, 'input_channel_dim': 2,
                                               'dims_number': 4},
+                                 'const_conv_2_b': {'shape': np.array([96]), 'value': np.zeros(96)},
                                  'conv_2_b': {'shape': np.array([96]), 'value': np.zeros(96)},
                                  'conv_2_data': {'shape': np.array([1, 55, 55, 96])},
                                  })
@@ -900,37 +1121,49 @@ class FuseLinOpsTests(unittest.TestCase):
         graph = 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', 'fc_1'),
+                             ('const_fc_1_w', 'fc_1_w'),
+                             ('const_fc_1_b', 'fc_1_b'),
                              ('fc_1_w', 'fc_1'),
                              ('fc_1_b', 'fc_1'),
                              ('fc_1', 'fc_1_data'),
+                             ('fc_1_data', 'op_output')
                              ],
                             {'placeholder_1_data': {'shape': np.array([1, 2048])},
                              'mul_1_data': {'shape': np.array([1, 2048])},
+                             'const_mul_1_w': {'shape': np.array([2048]), 'value': np.array([x for x in range(2048)])},
                              'mul_1_w': {'shape': np.array([2048]), 'value': np.array([x for x in range(2048)])},
+                             'const_fc_1_w': {'shape': np.array([10260, 2048]), 'value': np.ones((10260, 2048))},
                              'fc_1_w': {'shape': np.array([10260, 2048]), 'value': np.ones((10260, 2048)),
                                         'output_channel_dim': 0, 'input_channel_dim': 1,
                                         'dims_number': 2},
+                             'const_fc_1_b': {'shape': np.array([10260]), 'value': np.ones(10260)},
                              'fc_1_b': {'shape': np.array([10260]), 'value': np.ones(10260)},
-                             'fc_1_data': {'shape': np.array([1, 10260]), 'is_output': True},
+                             'fc_1_data': {'shape': np.array([1, 10260])},
                              })
         ref_weights = np.ones((10260, 2048)) * np.array([x for x in range(2048)])
 
         graph_ref = build_graph(nodes_attributes,
                                 [('placeholder_1', 'placeholder_1_data'),
                                  ('placeholder_1_data', 'fc_1'),
+                                 ('const_fc_1_w', 'fc_1_w'),
+                                 ('const_fc_1_b', 'fc_1_b'),
                                  ('fc_1_w', 'fc_1'),
                                  ('fc_1_b', 'fc_1'),
                                  ('fc_1', 'fc_1_data'),
+                                 ('fc_1_data', 'op_output')
                                  ],
                                 {'placeholder_1_data': {'shape': np.array([1, 2048])},
+                                 'const_fc_1_w': {'shape': ref_weights.shape, 'value': ref_weights},
                                  'fc_1_w': {'shape': ref_weights.shape, 'value': ref_weights,
                                             'output_channel_dim': 0, 'input_channel_dim': 1,
                                             'dims_number': 2},
+                                 'const_fc_1_b': {'shape': np.array([10260]), 'value': np.ones(10260)},
                                  'fc_1_b': {'shape': np.array([10260]), 'value': np.ones(10260)},
-                                 'fc_1_data': {'shape': np.array([1, 10260]), 'is_output': True},
+                                 'fc_1_data': {'shape': np.array([1, 10260])},
                                  })
 
         fuse_linear_ops(graph)
@@ -945,15 +1178,20 @@ class FuseLinOpsTests(unittest.TestCase):
         graph = build_graph(nodes_attributes,
                             [('placeholder_1', 'placeholder_1_data'),
                              ('placeholder_1_data', 'fc_1'),
+                             ('const_fc_1_w', 'fc_1_w'),
                              ('fc_1_w', 'fc_1'),
                              ('fc_1', 'fc_1_data'),
                              ('fc_1_data', 'add_1'),
+                             ('const_add_1_w', 'add_1_w'),
                              ('add_1_w', 'add_1'),
                              ('add_1', 'add_1_data'),
+                             ('add_1_data', 'op_output')
                              ],
                             {'placeholder_1_data': {'shape': np.array([1, 2048])},
-                             'add_1_data': {'shape': np.array([1, 10260]), 'is_output': True},
+                             'add_1_data': {'shape': np.array([1, 10260])},
+                             'const_add_1_w': {'shape': np.array([1]), 'value': np.array([6]), 'data_type': None},
                              'add_1_w': {'shape': np.array([1]), 'value': np.array([6]), 'data_type': None},
+                             'const_fc_1_w': {'shape': np.array([10260, 2048]), 'value': np.ones((10260, 2048))},
                              'fc_1_w': {'shape': np.array([10260, 2048]), 'value': np.ones((10260, 2048)),
                                         'output_channel_dim': 0, 'input_channel_dim': 1,
                                         'dims_number': 2, 'data_type': None},
@@ -966,16 +1204,21 @@ class FuseLinOpsTests(unittest.TestCase):
         graph_ref = build_graph(nodes_attributes,
                                 [('placeholder_1', 'placeholder_1_data'),
                                  ('placeholder_1_data', 'fc_1'),
+                                 ('const_fc_1_w', 'fc_1_w'),
+                                 ('const_fc_1_b', 'fc_1_b'),
                                  ('fc_1_w', 'fc_1'),
                                  ('fc_1_b', 'fc_1'),
                                  ('fc_1', 'fc_1_data'),
+                                 ('fc_1_data', 'op_output')
                                  ],
                                 {'placeholder_1_data': {'shape': np.array([1, 2048])},
+                                 'const_fc_1_w': {'shape': ref_weights.shape, 'value': ref_weights},
                                  'fc_1_w': {'shape': ref_weights.shape, 'value': ref_weights,
                                             'output_channel_dim': 0, 'input_channel_dim': 1,
                                             'dims_number': 2},
+                                 'const_fc_1_b': {'shape': ref_biases.shape, 'value': ref_biases},
                                  'fc_1_b': {'shape': ref_biases.shape, 'value': ref_biases},
-                                 'fc_1_data': {'shape': np.array([1, 10260]), 'is_output': True},
+                                 'fc_1_data': {'shape': np.array([1, 10260])},
                                  })
 
         fuse_linear_ops(graph)
@@ -991,51 +1234,68 @@ class FuseLinOpsTests(unittest.TestCase):
         graph = build_graph(nodes_attributes,
                             [('placeholder_1_data', 'conv_1'),
                              ('conv_1', 'conv_1_data'),
+                             ('const_conv_1_w', 'conv_1_w'),
+                             ('const_conv_1_b', 'conv_1_b'),
                              ('conv_1_w', 'conv_1'),
                              ('conv_1_b', 'conv_1'),
                              ('conv_1_data', 'add_1'),
+                             ('const_add_1_w', 'add_1_w'),
                              ('add_1_w', 'add_1'),
                              ('add_1', 'add_1_data'),
                              ('concat_1', 'concat_1_data'),
+                             ('const_mul_1_w', 'mul_1_w'),
                              ('mul_1_w', 'mul_1'),
                              ('mul_1', 'mul_1_data'),
                              ('add_1_data', 'concat_1'),
                              ('mul_1_data', 'concat_1'),
-                             ('add_1_data', 'mul_1')],
-
+                             ('add_1_data', 'mul_1'),
+                             ('concat_1_data', 'op_output')
+                             ],
                             {'placeholder_1_data': {'shape': np.array([1, 227, 227, 3])},
+                             'const_conv_1_w': {'shape': np.array([1, 1, 3, 3]), 'value': np.zeros((1, 1, 3, 3))},
                              'conv_1_w': {'shape': np.array([1, 1, 3, 3]), 'value': np.zeros((1, 1, 3, 3)),
                                           'output_channel_dim': 3, 'input_channel_dim': 2,
                                           'dims_number': 4},
+                             'const_conv_1_b': {'shape': np.array([3]), 'value': np.zeros(3)},
                              'conv_1_b': {'shape': np.array([3]), 'value': np.zeros(3)},
                              'conv_1_data': {'shape': np.array([1, 227, 227, 3])},
                              'mul_1_data': {'shape': np.array([1, 227, 227, 3])},
                              'add_1_data': {'shape': np.array([1, 227, 227, 3])},
+                             'const_mul_1_w': {'shape': np.array([1]), 'value': np.array([6])},
                              'mul_1_w': {'shape': np.array([1]), 'value': np.array([6])},
+                             'const_add_1_w': {'shape': np.array([1]), 'value': np.array([1])},
                              'add_1_w': {'shape': np.array([1]), 'value': np.array([1])},
-                             'concat_1_data': {'is_output': True}
+                             'concat_1_data': {}
                              })
 
         graph_ref = build_graph(nodes_attributes,
                                 [('placeholder_1_data', 'conv_1'),
                                  ('conv_1', 'conv_1_data'),
+                                 ('const_conv_1_w', 'conv_1_w'),
+                                 ('const_conv_1_b', 'conv_1_b'),
                                  ('conv_1_w', 'conv_1'),
                                  ('conv_1_b', 'conv_1'),
                                  ('conv_1_data', 'concat_1'),
+                                 ('const_mul_1_w', 'mul_1_w'),
                                  ('mul_1_w', 'mul_1'),
                                  ('conv_1_data', 'mul_1'),
                                  ('concat_1', 'concat_1_data'),
                                  ('mul_1', 'mul_1_data'),
-                                 ('mul_1_data', 'concat_1')],
+                                 ('mul_1_data', 'concat_1'),
+                                 ('concat_1_data', 'op_output')
+                                 ],
                                 {'placeholder_1_data': {'shape': np.array([1, 227, 227, 3])},
+                                 'const_conv_1_w': {'shape': np.array([1, 1, 3, 3]), 'value': np.zeros((1, 1, 3, 3))},
                                  'conv_1_w': {'shape': np.array([1, 1, 3, 3]), 'value': np.zeros((1, 1, 3, 3)),
                                               'output_channel_dim': 3, 'input_channel_dim': 2,
                                               'dims_number': 4},
+                                 'const_conv_1_b': {'shape': np.array([3]), 'value': np.ones(3)},
                                  'conv_1_b': {'shape': np.array([3]), 'value': np.ones(3)},
                                  'conv_1_data': {'shape': np.array([1, 227, 227, 3])},
                                  'mul_1_data': {'shape': np.array([1, 227, 227, 3])},
+                                 'const_mul_1_w': {'shape': np.array([1]), 'value': np.array([6])},
                                  'mul_1_w': {'shape': np.array([1]), 'value': np.array([6])},
-                                 'concat_1_data': {'is_output': True}
+                                 'concat_1_data': {}
                                  })
 
         fuse_linear_ops(graph)
@@ -1051,69 +1311,92 @@ class FuseLinOpsTests(unittest.TestCase):
         graph = 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', 'conv_1'),
+                             ('const_conv_1_w', 'conv_1_w'),
+                             ('const_conv_1_b', 'conv_1_b'),
                              ('conv_1_w', 'conv_1'),
                              ('conv_1_b', 'conv_1'),
                              ('conv_1', 'conv_1_data'),
                              ('mul_1_data', 'conv_2'),
+                             ('const_conv_2_w', 'conv_2_w'),
+                             ('const_conv_2_b', 'conv_2_b'),
                              ('conv_2_w', 'conv_2'),
                              ('conv_2_b', 'conv_2'),
                              ('conv_2', 'conv_2_data'),
                              ('conv_1_data', 'concat_1'),
                              ('conv_2_data', 'concat_1'),
-                             ('concat_1', 'concat_1_data')
+                             ('concat_1', 'concat_1_data'),
+                             ('concat_1_data', 'op_output')
+
                              ],
                             {'placeholder_1_data': {'shape': np.array([1, 227, 227, 3])},
                              'mul_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_conv_1_w': {'shape': np.array([11, 11, 3, 96]), 'value': np.ones((11, 11, 3, 96))},
                              'conv_1_w': {'shape': np.array([11, 11, 3, 96]), 'value': np.ones((11, 11, 3, 96)),
                                           'output_channel_dim': 3, 'input_channel_dim': 2,
                                           'dims_number': 4},
+                             'const_conv_1_b': {'shape': np.array([96]), 'value': np.zeros(96)},
                              'conv_1_b': {'shape': np.array([96]), 'value': np.zeros(96)},
                              'conv_1_data': {'shape': np.array([1, 55, 55, 96])},
                              'conv_2': {'can_be_fused': False},
+                             'const_conv_2_w': {'shape': np.array([11, 11, 3, 96]), 'value': np.ones((11, 11, 3, 96))},
                              'conv_2_w': {'shape': np.array([11, 11, 3, 96]), 'value': np.ones((11, 11, 3, 96)),
                                           'output_channel_dim': 3, 'input_channel_dim': 2,
                                           'dims_number': 4},
+                             'const_conv_2_b': {'shape': np.array([96]), 'value': np.zeros(96)},
                              'conv_2_b': {'shape': np.array([96]), 'value': np.zeros(96)},
                              'conv_2_data': {'shape': np.array([1, 55, 55, 96])},
-                             'concat_1_data': {'is_output': True}
+                             'concat_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', 'conv_1'),
+                                 ('const_conv_1_w', 'conv_1_w'),
+                                 ('const_conv_1_b', 'conv_1_b'),
                                  ('conv_1_w', 'conv_1'),
                                  ('conv_1_b', 'conv_1'),
                                  ('conv_1', 'conv_1_data'),
                                  ('mul_1_data', 'conv_2'),
+                                 ('const_conv_2_w', 'conv_2_w'),
+                                 ('const_conv_2_b', 'conv_2_b'),
                                  ('conv_2_w', 'conv_2'),
                                  ('conv_2_b', 'conv_2'),
                                  ('conv_2', 'conv_2_data'),
                                  ('conv_1_data', 'concat_1'),
                                  ('conv_2_data', 'concat_1'),
-                                 ('concat_1', 'concat_1_data')
+                                 ('concat_1', 'concat_1_data'),
+                                 ('concat_1_data', 'op_output')
                                  ],
                                 {'placeholder_1_data': {'shape': np.array([1, 227, 227, 3])},
                                  'mul_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_conv_1_w': {'shape': np.array([11, 11, 3, 96]), 'value': np.ones((11, 11, 3, 96))},
                                  'conv_1_w': {'shape': np.array([11, 11, 3, 96]), 'value': np.ones((11, 11, 3, 96)),
                                               'output_channel_dim': 3, 'input_channel_dim': 2,
                                               'dims_number': 4},
+                                 'const_conv_1_b': {'shape': np.array([96]), 'value': np.zeros(96)},
                                  'conv_1_b': {'shape': np.array([96]), 'value': np.zeros(96)},
                                  'conv_1_data': {'shape': np.array([1, 55, 55, 96])},
                                  'conv_2': {'can_be_fused': False},
+                                 'const_conv_2_w': {'shape': np.array([11, 11, 3, 96]), 'value': np.ones((11, 11, 3, 96))},
                                  'conv_2_w': {'shape': np.array([11, 11, 3, 96]), 'value': np.ones((11, 11, 3, 96)),
                                               'output_channel_dim': 3, 'input_channel_dim': 2,
                                               'dims_number': 4},
+                                 'const_conv_2_b': {'shape': np.array([96]), 'value': np.zeros(96)},
                                  'conv_2_b': {'shape': np.array([96]), 'value': np.zeros(96)},
                                  'conv_2_data': {'shape': np.array([1, 55, 55, 96])},
-                                 'concat_1_data': {'is_output': True}
+                                 'concat_1_data': {}
                                  })
 
         fuse_linear_ops(graph)
@@ -1129,69 +1412,91 @@ class FuseLinOpsTests(unittest.TestCase):
         graph = 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', 'conv_1'),
+                             ('const_conv_1_w', 'conv_1_w'),
+                             ('const_conv_1_b', 'conv_1_b'),
                              ('conv_1_w', 'conv_1'),
                              ('conv_1_b', 'conv_1'),
                              ('conv_1', 'conv_1_data'),
                              ('mul_1_data', 'conv_2'),
+                             ('const_conv_2_w', 'conv_2_w'),
+                             ('const_conv_2_b', 'conv_2_b'),
                              ('conv_2_w', 'conv_2'),
                              ('conv_2_b', 'conv_2'),
                              ('conv_2', 'conv_2_data'),
                              ('conv_1_data', 'concat_1'),
                              ('conv_2_data', 'concat_1'),
-                             ('concat_1', 'concat_1_data')
+                             ('concat_1', 'concat_1_data'),
+                             ('concat_1_data', 'op_output')
                              ],
                             {'placeholder_1_data': {'shape': np.array([1, 227, 227, 3])},
                              'mul_1': {'can_be_fused': False},
                              'mul_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_conv_1_w': {'shape': np.array([11, 11, 3, 96]), 'value': np.ones((11, 11, 3, 96))},
                              'conv_1_w': {'shape': np.array([11, 11, 3, 96]), 'value': np.ones((11, 11, 3, 96)),
                                           'output_channel_dim': 3, 'input_channel_dim': 2,
                                           'dims_number': 4},
+                             'const_conv_1_b': {'shape': np.array([96]), 'value': np.zeros(96)},
                              'conv_1_b': {'shape': np.array([96]), 'value': np.zeros(96)},
                              'conv_1_data': {'shape': np.array([1, 55, 55, 96])},
+                             'const_conv_2_w': {'shape': np.array([11, 11, 3, 96]), 'value': np.ones((11, 11, 3, 96))},
                              'conv_2_w': {'shape': np.array([11, 11, 3, 96]), 'value': np.ones((11, 11, 3, 96)),
                                           'output_channel_dim': 3, 'input_channel_dim': 2,
                                           'dims_number': 4},
+                             'const_conv_2_b': {'shape': np.array([96]), 'value': np.zeros(96)},
                              'conv_2_b': {'shape': np.array([96]), 'value': np.zeros(96)},
                              'conv_2_data': {'shape': np.array([1, 55, 55, 96])},
-                             'concat_1_data': {'is_output': True}
+                             'concat_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', 'conv_1'),
+                                 ('const_conv_1_w', 'conv_1_w'),
+                                 ('const_conv_1_b', 'conv_1_b'),
                                  ('conv_1_w', 'conv_1'),
                                  ('conv_1_b', 'conv_1'),
                                  ('conv_1', 'conv_1_data'),
                                  ('mul_1_data', 'conv_2'),
+                                 ('const_conv_2_w', 'conv_2_w'),
+                                 ('const_conv_2_b', 'conv_2_b'),
                                  ('conv_2_w', 'conv_2'),
                                  ('conv_2_b', 'conv_2'),
                                  ('conv_2', 'conv_2_data'),
                                  ('conv_1_data', 'concat_1'),
                                  ('conv_2_data', 'concat_1'),
-                                 ('concat_1', 'concat_1_data')
+                                 ('concat_1', 'concat_1_data'),
+                                 ('concat_1_data', 'op_output')
                                  ],
                                 {'placeholder_1_data': {'shape': np.array([1, 227, 227, 3])},
                                  'mul_1': {'can_be_fused': False},
                                  'mul_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_conv_1_w': {'shape': np.array([11, 11, 3, 96]), 'value': np.ones((11, 11, 3, 96))},
                                  'conv_1_w': {'shape': np.array([11, 11, 3, 96]), 'value': np.ones((11, 11, 3, 96)),
                                               'output_channel_dim': 3, 'input_channel_dim': 2,
                                               'dims_number': 4},
+                                 'const_conv_1_b': {'shape': np.array([96]), 'value': np.zeros(96)},
                                  'conv_1_b': {'shape': np.array([96]), 'value': np.zeros(96)},
                                  'conv_1_data': {'shape': np.array([1, 55, 55, 96])},
+                                 'const_conv_2_w': {'shape': np.array([11, 11, 3, 96]), 'value': np.ones((11, 11, 3, 96))},
                                  'conv_2_w': {'shape': np.array([11, 11, 3, 96]), 'value': np.ones((11, 11, 3, 96)),
                                               'output_channel_dim': 3, 'input_channel_dim': 2,
                                               'dims_number': 4},
+                                 'const_conv_2_b': {'shape': np.array([96]), 'value': np.zeros(96)},
                                  'conv_2_b': {'shape': np.array([96]), 'value': np.zeros(96)},
                                  'conv_2_data': {'shape': np.array([1, 55, 55, 96])},
-                                 'concat_1_data': {'is_output': True}
+                                 'concat_1_data': {}
                                  })
 
         fuse_linear_ops(graph)