tvm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [incubator-tvm] siju-samuel commented on a change in pull request #5839: [Torch][Quantized] Fix converting serialized quantized models
Date Thu, 18 Jun 2020 08:43:20 GMT

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



##########
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:
       Just one more nit.
   Can you move this comment also inside `_is_quantized_tensor` and remove  the below comment
from other places
   
    _# See the comment in adaptive avg pool2d_




----------------------------------------------------------------
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:
users@infra.apache.org



Mime
View raw message