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/09/09 19:22:32 UTC

[GitHub] [incubator-tvm] masahi opened a new pull request #6433: [Relay, Torch] Fix stack op axis check, support torch::stack conversion for a static list

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


   


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



[GitHub] [incubator-tvm] masahi commented on pull request #6433: [Relay, Torch] Fix stack op axis check, support torch::stack conversion for a static list

Posted by GitBox <gi...@apache.org>.
masahi commented on pull request #6433:
URL: https://github.com/apache/incubator-tvm/pull/6433#issuecomment-689778742


   Windows build is failing, I don't know what to do about it @tqchen 


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



[GitHub] [incubator-tvm] masahi commented on a change in pull request #6433: [Relay, Torch] Fix stack op axis check, support torch::stack conversion for a static list

Posted by GitBox <gi...@apache.org>.
masahi commented on a change in pull request #6433:
URL: https://github.com/apache/incubator-tvm/pull/6433#discussion_r486037840



##########
File path: python/tvm/relay/frontend/pytorch.py
##########
@@ -1757,6 +1759,20 @@ def _impl(inputs, input_types):
     return _impl
 
 
+def _stack(prelude):
+    def _impl(inputs, input_types):
+        if isinstance(inputs[0], list):
+            # a static python list of tensors
+            dim = inputs[1]
+            return _op.stack(inputs[0], dim)
+        else:
+            # List ADT case
+            # TODO: is there a better way to check if an input is a List ADT?

Review comment:
       A proper assertion added and TODO removed




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



[GitHub] [incubator-tvm] masahi commented on a change in pull request #6433: [Relay, Torch] Fix stack op axis check, support torch::stack conversion for a static list

Posted by GitBox <gi...@apache.org>.
masahi commented on a change in pull request #6433:
URL: https://github.com/apache/incubator-tvm/pull/6433#discussion_r485960905



##########
File path: python/tvm/relay/frontend/pytorch.py
##########
@@ -1757,6 +1759,20 @@ def _impl(inputs, input_types):
     return _impl
 
 
+def _stack(prelude):
+    def _impl(inputs, input_types):
+        if isinstance(inputs[0], list):
+            # a static python list of tensors
+            dim = inputs[1]
+            return _op.stack(inputs[0], dim)
+        else:
+            # List ADT case
+            # TODO: is there a better way to check if an input is a List ADT?

Review comment:
       It seems if I do `infer_type` here, I get 
   ```
   List[Tensor[(8, 8), float32]]
   ```
   
   Also, if I do `prelude.mod.get_global_type_var("List")`, I get
   ```
   List
   ```
   
   so I'm looking for a way to test type equality for types defined in prelude, any idea? cc @kevinthesun 




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



[GitHub] [incubator-tvm] masahi commented on a change in pull request #6433: [Relay, Torch] Fix stack op axis check, support torch::stack conversion for a static list

Posted by GitBox <gi...@apache.org>.
masahi commented on a change in pull request #6433:
URL: https://github.com/apache/incubator-tvm/pull/6433#discussion_r485960905



##########
File path: python/tvm/relay/frontend/pytorch.py
##########
@@ -1757,6 +1759,20 @@ def _impl(inputs, input_types):
     return _impl
 
 
+def _stack(prelude):
+    def _impl(inputs, input_types):
+        if isinstance(inputs[0], list):
+            # a static python list of tensors
+            dim = inputs[1]
+            return _op.stack(inputs[0], dim)
+        else:
+            # List ADT case
+            # TODO: is there a better way to check if an input is a List ADT?

Review comment:
       It seems if I do `infer_type` here, I get 
   ```
   List[Tensor[(8, 8), float32]]
   ```
   
   Also, if I do `prelude.mod.get_global_type_var("List")`, I get
   ```
   List
   ```
   
   so I'm looking for a way to test type equality, any idea? cc @kevinthesun 




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



[GitHub] [incubator-tvm] masahi commented on a change in pull request #6433: [Relay, Torch] Fix stack op axis check, support torch::stack conversion for a static list

Posted by GitBox <gi...@apache.org>.
masahi commented on a change in pull request #6433:
URL: https://github.com/apache/incubator-tvm/pull/6433#discussion_r485960905



##########
File path: python/tvm/relay/frontend/pytorch.py
##########
@@ -1757,6 +1759,20 @@ def _impl(inputs, input_types):
     return _impl
 
 
+def _stack(prelude):
+    def _impl(inputs, input_types):
+        if isinstance(inputs[0], list):
+            # a static python list of tensors
+            dim = inputs[1]
+            return _op.stack(inputs[0], dim)
+        else:
+            # List ADT case
+            # TODO: is there a better way to check if an input is a List ADT?

Review comment:
       It seems if I do `infer_type` here, I get 
   ```
   List[Tensor[(8, 8), float32]]
   ```
   
   Also, if I do `prelude.mod.get_global_type_var("List")`, I get
   ```
   List
   ```
   
   so I'm looking for a way to test a type equality, any idea? cc @kevinthesun 




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



[GitHub] [incubator-tvm] masahi commented on a change in pull request #6433: [Relay, Torch] Fix stack op axis check, support torch::stack conversion for a static list

Posted by GitBox <gi...@apache.org>.
masahi commented on a change in pull request #6433:
URL: https://github.com/apache/incubator-tvm/pull/6433#discussion_r485965532



##########
File path: python/tvm/relay/frontend/pytorch.py
##########
@@ -1757,6 +1759,20 @@ def _impl(inputs, input_types):
     return _impl
 
 
+def _stack(prelude):
+    def _impl(inputs, input_types):
+        if isinstance(inputs[0], list):
+            # a static python list of tensors
+            dim = inputs[1]
+            return _op.stack(inputs[0], dim)
+        else:
+            # List ADT case
+            # TODO: is there a better way to check if an input is a List ADT?

Review comment:
       it seems this works
   
   ```
   ty = _infer_type_with_prelude(inputs[0], prelude)
   list_ty = prelude.mod.get_global_type_var("List")
   assert ty.func == list_ty
               
   ```




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



[GitHub] [incubator-tvm] zhiics commented on a change in pull request #6433: [Relay, Torch] Fix stack op axis check, support torch::stack conversion for a static list

Posted by GitBox <gi...@apache.org>.
zhiics commented on a change in pull request #6433:
URL: https://github.com/apache/incubator-tvm/pull/6433#discussion_r485938640



##########
File path: python/tvm/relay/frontend/pytorch.py
##########
@@ -1757,6 +1759,20 @@ def _impl(inputs, input_types):
     return _impl
 
 
+def _stack(prelude):
+    def _impl(inputs, input_types):
+        if isinstance(inputs[0], list):
+            # a static python list of tensors
+            dim = inputs[1]
+            return _op.stack(inputs[0], dim)
+        else:
+            # List ADT case
+            # TODO: is there a better way to check if an input is a List ADT?

Review comment:
       let's put an assignee after TODO




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



[GitHub] [incubator-tvm] kevinthesun commented on pull request #6433: [Relay, Torch] Fix stack op axis check, support torch::stack conversion for a static list

Posted by GitBox <gi...@apache.org>.
kevinthesun commented on pull request #6433:
URL: https://github.com/apache/incubator-tvm/pull/6433#issuecomment-689803314


   Thanks for fixing this. I'm trying to do the similar fix.


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



[GitHub] [incubator-tvm] masahi merged pull request #6433: [Relay, Torch] Fix stack op axis check, support torch::stack conversion for a static list

Posted by GitBox <gi...@apache.org>.
masahi merged pull request #6433:
URL: https://github.com/apache/incubator-tvm/pull/6433


   


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