rasagna-quic opened a new pull request, #15599:
URL: https://github.com/apache/tvm/pull/15599

   We see an accuracy issue when FQ2I is enabled for the avg_pool2d op in the 
deeplab_v3 QAT model. The error seems to be happening because the underlying 
graph has the output of the avg_pool mapped directly to the conv2d without a 
quantize-dequantize layer in between.
   
   Graph of interest
   ```mermaid
   graph TD;
   W(dequantize: A_scale, A_zero_point) --> Conv2d;
   A(dequantize: B_scale, B_zero_point) --> avg_pool2d;
   avg_pool2d --> Conv2d;
   Conv2d --> Output(quantize: C_scale, C_zero_point);
   ```
   
   Quantization parameters after Fq2i pass:
   qnn.avg_pool2d       (Bs, Bz, Cs, Cz)
   qnn.conv2d           (Cs, Cz, As, Az)
   qnn.requantize       (Cs*As, 0, Cs, Cz)
   
   Proposed fix for quantization parameters:
   qnn.avg_pool2d       (Bs, Bz, Bs, Bz)
   qnn.conv2d           (Bs, Bz, As, Az)
   qnn.requantize       (Cs*As, 0, Cs, Cz)
   
   where quantized parameters As, Bs, Cs are scales and Az, Bz, Cz are 
zeropoints.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to