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 22:41:02 UTC

[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

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