masahi opened a new pull request #5839:
URL: https://github.com/apache/incubator-tvm/pull/5839


   This is a workaround for the issue reported in 
https://github.com/pytorch/pytorch/issues/39690
   
   In short, if a quantized PyTorch model is serialized and loaded back, dtypes 
of output tensors are dropped and the loaded model doesn't have  `QUInt8` types 
at all.
   
   This becomes a problem when converting some Torch ops. For example,  below 
the output dtype of `quantize_per_tensor` becomes float (wrong), so 
`aten::adaptive_avg_pool2d` thinks this is a float operation. But obviously the 
output of `aten::quantize_per_tensor` should be a quantized tensor, so 
`aten::adaptive_avg_pool2d` has to be converted to the quantized version.
   
    The quantized resnet in torchvision uses `aten::adaptive_avg_pool2d`. So 
right now if we save and load back the qresnet, we get garbage result.
   
   ```
     %input.1 : Tensor = aten::quantize_per_tensor(%X.1, %7, %8, %9) # 
/home/masa/anaconda3
     ...
     %Xq.1 : Tensor = aten::adaptive_avg_pool2d(%input.1, %12)
   ```  
   
   please review @siju-samuel @anijain2305 


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to