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 2021/02/24 19:30:29 UTC

[GitHub] [tvm] masahi commented on a change in pull request #7517: [Torch] Pool ops, convert strides and pool_size to int

masahi commented on a change in pull request #7517:
URL: https://github.com/apache/tvm/pull/7517#discussion_r582242014



##########
File path: python/tvm/relay/frontend/pytorch.py
##########
@@ -1322,6 +1332,16 @@ def avg_pool2d(self, inputs, input_types):
         ceil_mode = int(inputs[4])
         count_include_pad = int(inputs[5])
 
+        if isinstance(pool_size, list):
+            for i in range(len(pool_size)):
+                if isinstance(pool_size[i], _expr.Constant):
+                    pool_size[i] = int(_infer_value_simulated(pool_size[i], {}).asnumpy())
+
+        if isinstance(strides, list):
+            for i in range(len(strides)):
+                if isinstance(strides[i], _expr.Constant):
+                    strides[i] = int(_infer_value_simulated(strides[i], {}).asnumpy())
+

Review comment:
       Let's introduce a helper function to remove all the dups.




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