Skip to content

Commit

Permalink
Fix too strict assert in onnx_quantizer.py (#22283)
Browse files Browse the repository at this point in the history
### Description
Partial answer to issue #19997. The example succeeds after this change.
  • Loading branch information
xadupre authored Nov 2, 2024
1 parent 6d5e970 commit d419df4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion onnxruntime/python/tools/quantization/onnx_quantizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,7 @@ def _dequantize_value(self, value_name):
self.model.model.producer_name == "onnx-quantizer" and scale_init is not None
):
# axis is not specified so scale_init must be a scalar.
assert onnx.numpy_helper.to_array(scale_init).size == 1
assert scale_init is None or onnx.numpy_helper.to_array(scale_init).size == 1

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

0 comments on commit d419df4

Please sign in to comment.