From c0b95f20d497a1d4a77e1054637ba8e57aaab7ee Mon Sep 17 00:00:00 2001 From: adrianlizarraga Date: Mon, 20 Nov 2023 13:53:03 -0800 Subject: [PATCH] Pass in final value of reduce_range to quantize_initializer() function --- onnxruntime/python/tools/quantization/onnx_quantizer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/onnxruntime/python/tools/quantization/onnx_quantizer.py b/onnxruntime/python/tools/quantization/onnx_quantizer.py index bb3f2fb0bca3c..5a3556d48605a 100644 --- a/onnxruntime/python/tools/quantization/onnx_quantizer.py +++ b/onnxruntime/python/tools/quantization/onnx_quantizer.py @@ -924,7 +924,7 @@ def __quantize_inputs( quant_type = quant_overrides["quant_type"].tensor_type symmetric = quant_overrides.get("symmetric", self.is_weight_symmetric) - reduce_range = quant_overrides.get("reduce_range", reduce_range) + reduce_range = quant_overrides.get("reduce_range", reduce_range and self.reduce_range) q_weight_name, zp_name, scale_name = self.quantize_initializer( initializer, quant_type, reduce_range=reduce_range, symmetric=symmetric @@ -1008,7 +1008,7 @@ def quantize_initializer(self, weight, qType, reduce_range=False, keep_float_wei w_data, qType, symmetric, - self.reduce_range and reduce_range, + reduce_range, self.min_real_range, )