From 4688a645cffa2c8eac71bb8859d695ab8f55f8f0 Mon Sep 17 00:00:00 2001 From: inisis Date: Thu, 6 Jun 2024 15:40:40 +0000 Subject: [PATCH] skip tied constant folding --- onnxslim/onnx_graphsurgeon/ir/graph.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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