Skip to content

Commit

Permalink
fix quantization errors of ConvTranspose with per_channel=True (#19996)
Browse files Browse the repository at this point in the history
### Description
<!-- Describe your changes. -->
 - update axis value for per_channel quantization of QDQConv
   - we should use `axis=1` for ConvTranspose operator.


### Motivation and Context
<!-- - Why is this change required? What problem does it solve?
- If it fixes an open issue, please link to the issue here. -->
- this PR fixes #19694,
which I have opened
  • Loading branch information
mo-ja authored Mar 30, 2024
1 parent f3a8642 commit 00244ea
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion onnxruntime/python/tools/quantization/operators/conv.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,8 @@ def quantize(self):
self.quantizer.quantize_activation_tensor(node.output[0])

if self.quantizer.is_per_channel():
self.quantizer.quantize_weight_tensor_per_channel(node.input[1], 0)
axis = 0 if node.op_type == "Conv" else 1
self.quantizer.quantize_weight_tensor_per_channel(node.input[1], axis)
else:
self.quantizer.quantize_weight_tensor(node.input[1])

Expand Down

0 comments on commit 00244ea

Please sign in to comment.