jwfromm commented on a change in pull request #4961: [Torch] Upsampling op 
support and enable registering a user defined op conversion map
URL: https://github.com/apache/incubator-tvm/pull/4961#discussion_r385830597
 
 

 ##########
 File path: python/tvm/relay/frontend/pytorch.py
 ##########
 @@ -614,6 +615,51 @@ def _impl(inputs, input_types):
         return _op.tensor.sqrt(data)
     return _impl
 
+def _floor():
+    def _impl(inputs, input_types):
+        data = inputs[0]
+        return _op.floor(data)
+    return _impl
+
+def _to():
+    def _impl(inputs, input_types):
+        data = inputs[0]
+        # special handling for aten::to(data, 6, _, _, _) case
+        # 6 means dtype = float
+        # this happens when converting upsampling with scale factor
+        cast_func = {
+            6: float,
+        }
+        if inputs[1] in cast_func and not isinstance(data, _expr.Expr):
 
 Review comment:
   This seems very specific, it looks like it only works for non expression 
inputs and casts to floats. Is there any reason not to add a `relay.cast` 
fallback for expression inputs and support other datatypes in the cast_func 
lookup?

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


With regards,
Apache Git Services

Reply via email to