Skip to content

Commit d419df4

Browse files
authored
Fix too strict assert in onnx_quantizer.py (microsoft#22283)
### Description Partial answer to issue microsoft#19997. The example succeeds after this change.
1 parent 6d5e970 commit d419df4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

onnxruntime/python/tools/quantization/onnx_quantizer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -942,7 +942,7 @@ def _dequantize_value(self, value_name):
942942
self.model.model.producer_name == "onnx-quantizer" and scale_init is not None
943943
):
944944
# axis is not specified so scale_init must be a scalar.
945-
assert onnx.numpy_helper.to_array(scale_init).size == 1
945+
assert scale_init is None or onnx.numpy_helper.to_array(scale_init).size == 1
946946

947947
dqlinear_name = value_name + "_DequantizeLinear"
948948
dqlinear_node = self.model.find_node_by_name(dqlinear_name, self.new_nodes, self.model.graph())

0 commit comments

Comments
 (0)