Failed to quantize ConvTranspose with per_channel=True
#19694
Labels
quantization
issues related to quantization
per_channel=True
#19694
Describe the issue
ConvTranspose layer cannot be quantized with
per_channel=True
.In the case of ConvTranspose, the axis of weight, axis=1, corresponds to the number of channels in the output, whereas QDQConv's per_channel quantization always quantizes on the axis of axis=0.
This seems to cause an error during the bias scale calculation in ConvTranspose because the shape of bias_scale does not match the shape of bias.
I have solved this issue by using different axis for Conv and ConvTranspose like here:
To reproduce
Here is the onnx file I used: onnx.zip
model generation with torch
quantization code with ONNX Runtime
Raised Error
Urgency
No response
Platform
Linux
OS Version
Ubuntu 20.04.5 LTS
ONNX Runtime Installation
Released Package
ONNX Runtime Version or Commit ID
1.17.1
ONNX Runtime API
Python
Architecture
X86
Execution Provider
Default CPU
Execution Provider Library Version
No response
Tasks
The text was updated successfully, but these errors were encountered: