Skip to content

Commit

Permalink
feat: support more expand elimination case (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
inisis authored Nov 28, 2024
1 parent 987fab1 commit 2ac5b68
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions onnxslim/core/optimization/dead_node_elimination.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ def dead_node_elimination(graph, is_subgraph=False):
if len(node.inputs) > 1 and isinstance(node.inputs[1], Constant):
constant_variable = node.inputs[1]
value = constant_variable.values
if value.ndim == 0 and value == 1:
if node.inputs[0].shape == node.outputs[0].shape:
delete_node(node)
logger.debug(f"removing {node.op} op: {node.name}")
elif np.all(value == 1) and (node.inputs[0].shape == node.outputs[0].shape):
elif value.ndim == 0 and value == 1:
delete_node(node)
logger.debug(f"removing {node.op} op: {node.name}")
elif node.op == "Concat":
Expand Down

0 comments on commit 2ac5b68

Please sign in to comment.