File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -60,16 +60,17 @@ def pre_optimize_action(self):
60
60
target_t = reshape_op .inputs [0 ].get_tensor_value (as_list = False )
61
61
target_shape = reshape_op .inputs [1 ].get_tensor_value (as_list = False )
62
62
new_data = np .reshape (target_t , tuple (target_shape ))
63
- const_name = utils .port_name (utils .make_name ("Const" ))
63
+ const_name = reshape_op .output [0 ]
64
+ self ._g .remove_node (reshape_op .name )
65
+ self ._g .make_const (const_name , new_data )
64
66
65
67
# point all children nodes inputs to the new node
66
68
for output_name in reshape_op .output :
67
69
for child in ops :
68
70
for i , name in enumerate (child .input ):
69
71
if name == output_name :
70
72
child .input [i ] = const_name
71
- self ._g .make_const (const_name , new_data )
72
- self ._g .remove_node (reshape_op .name )
73
+
73
74
self ._g .topological_sort (self ._g .get_nodes ())
74
75
75
76
def post_optimize_action (self ):
You can’t perform that action at this time.
0 commit comments