From 9c1889034c2c81151909fabcb717636b694b2566 Mon Sep 17 00:00:00 2001 From: inisis Date: Wed, 18 Dec 2024 01:31:48 +0800 Subject: [PATCH] fix tensor copy bug and skip some constant folding --- onnxslim/third_party/onnx_graphsurgeon/ir/graph.py | 1 + onnxslim/third_party/onnx_graphsurgeon/ir/tensor.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/onnxslim/third_party/onnx_graphsurgeon/ir/graph.py b/onnxslim/third_party/onnx_graphsurgeon/ir/graph.py index 4d40ea3..7345e07 100644 --- a/onnxslim/third_party/onnx_graphsurgeon/ir/graph.py +++ b/onnxslim/third_party/onnx_graphsurgeon/ir/graph.py @@ -915,6 +915,7 @@ def is_foldable(node): "QuantizeLinear", "DequantizeLinear", "DynamicQuantizeLinear", + "SequenceEmpty", } if node.op in NO_FOLD_OPS: return False diff --git a/onnxslim/third_party/onnx_graphsurgeon/ir/tensor.py b/onnxslim/third_party/onnx_graphsurgeon/ir/tensor.py index 6c1a5fe..b1805d3 100644 --- a/onnxslim/third_party/onnx_graphsurgeon/ir/tensor.py +++ b/onnxslim/third_party/onnx_graphsurgeon/ir/tensor.py @@ -236,7 +236,7 @@ def copy(self): Note: Generally, you should only ever make a copy of a Graph. """ - return Variable(self.name, self.dtype, self.shape) + return Variable(self.name, self.dtype, self.shape, self.type) def __eq__(self, other): """Perform a check to see if two variables are equal."""