masahi commented on a change in pull request #5839:
URL: https://github.com/apache/incubator-tvm/pull/5839#discussion_r442127672



##########
File path: python/tvm/relay/frontend/pytorch.py
##########
@@ -595,15 +601,18 @@ def _impl(inputs, input_types):
         return _op.log(_op.tensor.sigmoid(data))
     return _impl
 
-def _adaptive_avg_pool_2d():
+def _adaptive_avg_pool_2d(prelude):
     def _impl(inputs, input_types):
         data = inputs[0]
         output_size = _infer_shape(inputs[1])
 
         def func(x):
             return _op.nn.adaptive_avg_pool2d(x, output_size=output_size)
 
-        if input_types[0] == "quint8":
+        # If a quantized Torch module is saved and loaded back, dtype will be 
dropped
+        # input_types[0] can be float even though the input is a quantized 
tensor
+        # To reliably determine input types, we use Relay's type inference 
result
+        if _is_quantized_tensor(data, prelude):

Review comment:
       done




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