Skip to content

Commit

Permalink
fix delete node bug
Browse files Browse the repository at this point in the history
  • Loading branch information
inisis committed Dec 3, 2024
1 parent 3f3c754 commit 208cfa9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions onnxslim/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ def delete_node(node, input_var_idx=0, output_var_idx=0):
if not isinstance(feed, (Variable, Constant)):
feed.outputs.remove(node.inputs[input_var_idx])
feed.outputs.append(node.outputs[output_var_idx])
for user in list(node.inputs[input_var_idx].outputs):
for i, input in enumerate(user.inputs):
if input == node.inputs[input_var_idx]:
user.inputs[i] = node.outputs[output_var_idx]
node.outputs.clear()
else:
for next_node in next_nodes:
Expand Down

0 comments on commit 208cfa9

Please sign in to comment.