Skip to content

Commit

Permalink
add Concat elimination
Browse files Browse the repository at this point in the history
  • Loading branch information
inisis committed Jun 9, 2024
1 parent 2350a65 commit 0800c69
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions onnxslim/core/optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,13 @@ def graph_constant_fold_inplace(graph):
if len(node.inputs) > 1 and isinstance(node.inputs[1], Constant) and np.all(node.inputs[1].values == 1):
idx = 0 if idx == 1 else 1
delete_node(node, idx)
elif node.op == "Concat":
if len(node.inputs) == 1:
delete_node(node)
else:
for input in node.inputs:
if isinstance(input, Constant) and input.values.size == 0:
node.inputs.remove(input)


@register_fusion_pattern("FusionPadConv")
Expand Down

0 comments on commit 0800c69

Please sign in to comment.