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/03/04 19:50:21 UTC
[GitHub] [incubator-tvm] pyjhzwh opened a new pull request #4984: Fix stride
default value None in torch.nn.functional.avg_pool
pyjhzwh opened a new pull request #4984: Fix stride default value None in torch.nn.functional.avg_pool
URL: https://github.com/apache/incubator-tvm/pull/4984
The default value of stride in nn.functional.avg_pool is set as None,
https://github.com/apache/incubator-tvm/blob/5a0f39b5481a30a2eec49e27cbc17a722bd6ee6a/python/tvm/relay/frontend/pytorch.py#L461
It will cause `TVMError: Check failed: ObjectTypeChecker<TObjectRef>: :Check(ptr): Expect relay.Expr but get Array` since `inputs[2]` is empty.
Fix it by detecting None type of stride in tvm frontend pytorch.
----------------------------------------------------------------
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
With regards,
Apache Git Services
[GitHub] [incubator-tvm] masahi commented on a change in pull request #4984:
Fix stride default value None in torch.nn.functional.avg_pool
Posted by GitBox <gi...@apache.org>.
masahi commented on a change in pull request #4984: Fix stride default value None in torch.nn.functional.avg_pool
URL: https://github.com/apache/incubator-tvm/pull/4984#discussion_r387899300
##########
File path: python/tvm/relay/frontend/pytorch.py
##########
@@ -918,7 +921,7 @@ def _get_constant(node):
def _get_operator_nodes(nodes):
""" Returns torch IR nodes that need conversion to Relay """
- ops = {}
+ ops = []
Review comment:
You should not have this change in this pr. Fetch and rebase against master.
----------------------------------------------------------------
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
With regards,
Apache Git Services
[GitHub] [incubator-tvm] masahi commented on issue #4984: Fix stride default
value None in torch.nn.functional.avg_pool
Posted by GitBox <gi...@apache.org>.
masahi commented on issue #4984: Fix stride default value None in torch.nn.functional.avg_pool
URL: https://github.com/apache/incubator-tvm/pull/4984#issuecomment-595030851
Let's wait until the commit author issue is resolved https://discuss.tvm.ai/t/github-issue-the-commit-author-is-wrong-since-today/5880/
----------------------------------------------------------------
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
With regards,
Apache Git Services
[GitHub] [incubator-tvm] masahi commented on a change in pull request #4984:
Fix stride default value None in torch.nn.functional.avg_pool
Posted by GitBox <gi...@apache.org>.
masahi commented on a change in pull request #4984: Fix stride default value None in torch.nn.functional.avg_pool
URL: https://github.com/apache/incubator-tvm/pull/4984#discussion_r387959144
##########
File path: python/tvm/relay/frontend/pytorch.py
##########
@@ -458,7 +458,10 @@ def _impl(inputs, input_types):
data = inputs[0]
pool_size = _infer_shape(inputs[1])
- strides = _infer_shape(inputs[2])
+ if inputs[2]:
+ strides = _infer_shape(inputs[2])
+ else:
+ strides = pool_size
Review comment:
ok
----------------------------------------------------------------
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
With regards,
Apache Git Services
[GitHub] [incubator-tvm] pyjhzwh commented on a change in pull request
#4984: Fix stride default value None in torch.nn.functional.avg_pool
Posted by GitBox <gi...@apache.org>.
pyjhzwh commented on a change in pull request #4984: Fix stride default value None in torch.nn.functional.avg_pool
URL: https://github.com/apache/incubator-tvm/pull/4984#discussion_r387954278
##########
File path: python/tvm/relay/frontend/pytorch.py
##########
@@ -458,7 +458,10 @@ def _impl(inputs, input_types):
data = inputs[0]
pool_size = _infer_shape(inputs[1])
- strides = _infer_shape(inputs[2])
+ if inputs[2]:
+ strides = _infer_shape(inputs[2])
+ else:
+ strides = pool_size
Review comment:
https://github.com/pytorch/pytorch/blob/17a5c677963dc3ecb7ff505585ed15eadaaf74ef/torch/nn/functional.py#L269-L270
According to the description of strides above, for avg_pool2d. Stride's default value kernel_size, which should have the same size as pool_size here
----------------------------------------------------------------
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
With regards,
Apache Git Services
[GitHub] [incubator-tvm] masahi merged pull request #4984: Fix stride
default value None in torch.nn.functional.avg_pool
Posted by GitBox <gi...@apache.org>.
masahi merged pull request #4984: Fix stride default value None in torch.nn.functional.avg_pool
URL: https://github.com/apache/incubator-tvm/pull/4984
----------------------------------------------------------------
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
With regards,
Apache Git Services
[GitHub] [incubator-tvm] masahi commented on issue #4984: Fix stride default
value None in torch.nn.functional.avg_pool
Posted by GitBox <gi...@apache.org>.
masahi commented on issue #4984: Fix stride default value None in torch.nn.functional.avg_pool
URL: https://github.com/apache/incubator-tvm/pull/4984#issuecomment-596021345
It seems the github bug was resolved, I'll try merge it.
----------------------------------------------------------------
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
With regards,
Apache Git Services
[GitHub] [incubator-tvm] masahi commented on a change in pull request #4984:
Fix stride default value None in torch.nn.functional.avg_pool
Posted by GitBox <gi...@apache.org>.
masahi commented on a change in pull request #4984: Fix stride default value None in torch.nn.functional.avg_pool
URL: https://github.com/apache/incubator-tvm/pull/4984#discussion_r387899300
##########
File path: python/tvm/relay/frontend/pytorch.py
##########
@@ -918,7 +921,7 @@ def _get_constant(node):
def _get_operator_nodes(nodes):
""" Returns torch IR nodes that need conversion to Relay """
- ops = {}
+ ops = []
Review comment:
You should not have this chane in this pr. Fetch and rebase against master.
----------------------------------------------------------------
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
With regards,
Apache Git Services
[GitHub] [incubator-tvm] masahi commented on issue #4984: Fix stride default
value None in torch.nn.functional.avg_pool
Posted by GitBox <gi...@apache.org>.
masahi commented on issue #4984: Fix stride default value None in torch.nn.functional.avg_pool
URL: https://github.com/apache/incubator-tvm/pull/4984#issuecomment-594808062
Please add a test case. Add your test below.
https://github.com/apache/incubator-tvm/blob/fc7f0783940c362bf48cd46817956381196201e2/tests/python/frontend/pytorch/test_forward.py#L370
----------------------------------------------------------------
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
With regards,
Apache Git Services
[GitHub] [incubator-tvm] masahi commented on a change in pull request #4984:
Fix stride default value None in torch.nn.functional.avg_pool
Posted by GitBox <gi...@apache.org>.
masahi commented on a change in pull request #4984: Fix stride default value None in torch.nn.functional.avg_pool
URL: https://github.com/apache/incubator-tvm/pull/4984#discussion_r387936352
##########
File path: python/tvm/relay/frontend/pytorch.py
##########
@@ -458,7 +458,10 @@ def _impl(inputs, input_types):
data = inputs[0]
pool_size = _infer_shape(inputs[1])
- strides = _infer_shape(inputs[2])
+ if inputs[2]:
+ strides = _infer_shape(inputs[2])
+ else:
+ strides = pool_size
Review comment:
is this correct? we should use the default strides
----------------------------------------------------------------
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
With regards,
Apache Git Services
[GitHub] [incubator-tvm] masahi commented on issue #4984: Fix stride default
value None in torch.nn.functional.avg_pool
Posted by GitBox <gi...@apache.org>.
masahi commented on issue #4984: Fix stride default value None in torch.nn.functional.avg_pool
URL: https://github.com/apache/incubator-tvm/pull/4984#issuecomment-596021477
Looks like it is ok.
----------------------------------------------------------------
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
With regards,
Apache Git Services