From 109bc2b6e3348a6c573e800195084412efec62ce Mon Sep 17 00:00:00 2001 From: Christoph Berganski Date: Tue, 28 Jan 2025 16:07:23 +0100 Subject: [PATCH 1/2] Add GiveUniqueParameterTensors to ModelWrapper.cleanup transformations Fixes transformations which create copies of nodes without copying parameter tensors, resulting in unwanted entanglement. This manifests as later transformations having non-local effects, manipulating seemingly unrelated nodes. --- src/qonnx/core/modelwrapper.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/qonnx/core/modelwrapper.py b/src/qonnx/core/modelwrapper.py index f5895c56..cd802bd5 100644 --- a/src/qonnx/core/modelwrapper.py +++ b/src/qonnx/core/modelwrapper.py @@ -41,6 +41,7 @@ from qonnx.transformation.general import ( RemoveStaticGraphInputs, RemoveUnusedTensors, + GiveUniqueParameterTensors, SortCommutativeInputsInitializerLast, SortGraph, ) @@ -155,6 +156,7 @@ def cleanup(self): RemoveStaticGraphInputs(), SortGraph(), SortCommutativeInputsInitializerLast(), + GiveUniqueParameterTensors(), ] for trn in cleanup_transforms: transformed_model = transformed_model.transform(trn, cleanup=False, make_deepcopy=False) From 61f1c9a9f50390be62d44c6c46c211cd9c5805a1 Mon Sep 17 00:00:00 2001 From: Christoph Berganski Date: Tue, 28 Jan 2025 16:53:04 +0100 Subject: [PATCH 2/2] Fix isort --- src/qonnx/core/modelwrapper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qonnx/core/modelwrapper.py b/src/qonnx/core/modelwrapper.py index cd802bd5..ed38d074 100644 --- a/src/qonnx/core/modelwrapper.py +++ b/src/qonnx/core/modelwrapper.py @@ -39,9 +39,9 @@ from qonnx.core.datatype import DataType from qonnx.transformation.double_to_single_float import DoubleToSingleFloat from qonnx.transformation.general import ( + GiveUniqueParameterTensors, RemoveStaticGraphInputs, RemoveUnusedTensors, - GiveUniqueParameterTensors, SortCommutativeInputsInitializerLast, SortGraph, )