masahi commented on a change in pull request #8443:
URL: https://github.com/apache/tvm/pull/8443#discussion_r670324562
##########
File path: python/tvm/relay/frontend/pytorch.py
##########
@@ -2329,6 +2331,30 @@ def flip(self, inputs, input_types):
axis = inputs[1]
return _op.transform.reverse(data, axis=axis[0])
+ def grid_sampler(self, inputs, input_types):
+ data = inputs[0]
+ grid = inputs[1]
+
+ # Torch grid shape is like [batch, out_height, out_width, 2], but
+ # TVM grid is [batch, 2, out_height, out_width], so here grid need to
be converted
+ grid = _op.transform.transpose(grid, axes=[0, 3, 1, 2])
+ return _op.image.grid_sample(data, grid, method="bilinear",
layout="NCHW")
+
+ def im2col(self, inputs, input_types):
+ r"""
+ Torch F.unfold set kerenl_size, dilation, padding, stride as pairs
before calling im2col
+ but it brokern TVM "if condition expression", so please USE
torch._C._nn.im2col instead
+ of F.unfold and make sure giving paired parameters. Please reference
test_forward_im2col
+ in file tests/python/frontend/pytorch/test_forward.py.
Review comment:
First of all, please fix the typo and grammar error, otherwise the
comments do not make sense. I don't understand what is "if condition
expression". Please revisit this problem assuming you don't need to support
script mode. `torch._C._nn.im2col` is not supposed to be used by users, we
should support the usage of `torch.unfold`.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]