@@ -141,8 +141,8 @@ def rewrite_transpose(g, ops):
141
141
dims = [i for i in range (len (shape ) - 1 , - 1 , - 1 )]
142
142
output .set_attr ("perm" , dims )
143
143
g .remove_input (output , output .input [1 ])
144
- to_delete = [n for n in set ( match .get_nodes () ) if n != output ]
145
- g .delete_nodes_without_dependency (to_delete )
144
+ to_delete = [n for n in match .get_nodes () if n != output ]
145
+ g .safe_remove_nodes (to_delete )
146
146
return ops
147
147
148
148
@@ -174,7 +174,7 @@ def rewrite_random_normal(g, ops):
174
174
attr = {"shape" : shape , "mean" : mean , "scale" : 1.0 , "dtype" : dtype })
175
175
176
176
g .replace_all_inputs (ops , output .output [0 ], new_node .output [0 ])
177
- g .delete_nodes_without_dependency ( set ( match .get_nodes () ))
177
+ g .safe_remove_nodes ( match .get_nodes ())
178
178
return ops
179
179
180
180
@@ -206,7 +206,7 @@ def rewrite_dropout(g, ops):
206
206
dtypes = [g .get_dtype (inputs2 .input [0 ])]
207
207
)
208
208
g .replace_all_inputs (ops , outputs .output [0 ], new_node .output [0 ])
209
- g .delete_nodes_without_dependency ( set ( match .get_nodes () ))
209
+ g .safe_remove_nodes ( match .get_nodes ())
210
210
211
211
# remove dropout if its ratio is 1.0
212
212
for node in g .get_nodes ():
@@ -291,8 +291,8 @@ def rewrite_flatten(g, ops):
291
291
292
292
g .set_shape (out_name , input_shape [:- 2 ] + [new_dim ])
293
293
g .replace_all_inputs (ops , reshape_node .output [0 ], out_name )
294
- to_delete = [n for n in set ( match .get_nodes () ) if n != input_node ]
295
- g .delete_nodes_without_dependency (to_delete )
294
+ to_delete = [n for n in match .get_nodes () if n != input_node ]
295
+ g .safe_remove_nodes (to_delete )
296
296
297
297
return ops
298
298
@@ -649,7 +649,7 @@ def run_rewriters(g, funcs, continue_on_error):
649
649
else :
650
650
raise ex
651
651
652
- if logger . isEnabledFor ( constants . VERBOSE ):
652
+ if utils . is_debug_mode ( ):
653
653
broken_outputs = g .check_integrity ()
654
654
if broken_outputs :
655
655
logging .error (
0 commit comments