Skip to content

Commit

Permalink
simplify code
Browse files Browse the repository at this point in the history
  • Loading branch information
inisis committed Jun 19, 2024
1 parent 6eb2530 commit 92245d5
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions onnxslim/core/optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,7 @@ def graph_constant_fold_inplace(graph):
logger.debug(f"removing Add op: {node.name}")
elif node.op == "Expand":
if len(node.inputs) > 1 and isinstance(node.inputs[1], Constant) and np.all(node.inputs[1].values == 1):
idx, constant_variable = get_constant_variable(node, return_idx=True)
idx = 0 if idx == 1 else 1
delete_node(node, idx)
delete_node(node)
logger.debug(f"removing Expand op: {node.name}")
elif node.op == "Concat":
if len(node.inputs) == 1:
Expand Down

0 comments on commit 92245d5

Please sign in to comment.