You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2020/06/12 08:47:47 UTC

[GitHub] [incubator-tvm] t-vi commented on a change in pull request #5787: support aten::type_as in the pytorch frontend

t-vi commented on a change in pull request #5787:
URL: https://github.com/apache/incubator-tvm/pull/5787#discussion_r439291179



##########
File path: tests/python/frontend/pytorch/test_forward.py
##########
@@ -836,6 +836,20 @@ def forward(self, *args):
     input_data = torch.rand(input_shape).float()
     verify_model(Size1().float().eval(), input_data=input_data)
 
+
+def test_type_as():
+    torch.set_grad_enabled(False)
+    input_shape = [1, 3]
+
+    class TypeAsInt32(Module):
+        def forward(self, *args):
+            int32_tensor = torch.zeros(1, 3, dtype=torch.int32)
+            return args[0].type_as(int32_tensor)

Review comment:
       Great stuff!
   
   I would suggest to test more dtypes.
   (One of my main goals with #5779 is to be able to use input_types safely, and I hit troubles with it before.)




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