diff --git a/onnxslim/onnx_graphsurgeon/ir/graph.py b/onnxslim/onnx_graphsurgeon/ir/graph.py index fac6f36..4b9f848 100644 --- a/onnxslim/onnx_graphsurgeon/ir/graph.py +++ b/onnxslim/onnx_graphsurgeon/ir/graph.py @@ -957,7 +957,7 @@ def all_tensors_const(tensors): graph_constants.update({out.name: out for out in node.outputs}) return graph_constants - graph_constants = {name: tensor for name, tensor in clone_tensors.items() if isinstance(tensor, Constant)} + graph_constants = {name: tensor for name, tensor in clone_tensors.items() if (isinstance(tensor, Constant) and len(tensor.outputs) == 1)} graph_constants = update_foldable_outputs(graph_constants) # Pass 4: Shape Folding