File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed
onnxruntime/python/tools/quantization Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change 55# --------------------------------------------------------------------------
66from __future__ import annotations
77
8+ import copy
89import logging
910import os
1011import tempfile
@@ -988,8 +989,9 @@ def load_model_with_shape_infer(model_path: Path) -> ModelProto:
988989
989990def save_and_reload_model_with_shape_infer (model : ModelProto ) -> ModelProto :
990991 with tempfile .TemporaryDirectory (prefix = "ort.quant." ) as quant_tmp_dir :
992+ model_copy = copy .deepcopy (model )
991993 model_path = Path (quant_tmp_dir ).joinpath ("model.onnx" )
992- onnx .save_model (model , model_path .as_posix (), save_as_external_data = True )
994+ onnx .save_model (model_copy , model_path .as_posix (), save_as_external_data = True )
993995 return load_model_with_shape_infer (model_path )
994996
995997
You can’t perform that action at this time.
0 commit comments