masahi commented on a change in pull request #5142: [Torch] Add support for
max_pool1d
URL: https://github.com/apache/incubator-tvm/pull/5142#discussion_r397046667
##########
File path: tests/python/frontend/pytorch/test_forward.py
##########
@@ -363,9 +363,35 @@ class MaxPool2D2(Module):
def forward(self, *args):
return torch.nn.MaxPool2d(kernel_size=[10, 10])(args[0])
+ class MaxPool2D3(Module):
+ def forward(self, *args):
+ return torch.nn.MaxPool2d(kernel_size=[4, 4], padding=2,
stride=2)(args[0])
+
input_data = torch.rand(input_shape).float()
verify_model(MaxPool2D1().float().eval(), input_data=input_data)
verify_model(MaxPool2D2().float().eval(), input_data=input_data)
+ verify_model(MaxPool2D3().float().eval(), input_data=input_data)
+
+def test_forward_maxpool1d():
+ torch.set_grad_enabled(False)
+ input_shape = [1, 3, 10]
+
+ class MaxPool1D1(Module):
+ def forward(self, *args):
+ return torch.nn.MaxPool1d(kernel_size=1)(args[0])
+
+ class MaxPool1D2(Module):
+ def forward(self, *args):
+ return torch.nn.MaxPool1d(kernel_size=10)(args[0])
+
+ class MaxPool1D3(Module):
+ def forward(self, *args):
+ return torch.nn.MaxPool1d(kernel_size=4, padding=2,
stride=2)(args[0])
+
+ input_data = torch.rand(input_shape).float()
+ verify_model(MaxPool1D1().float().eval(), input_data=input_data)
+ verify_model(MaxPool1D2().float().eval(), input_data=input_data)
+ verify_model(MaxPool1D3().float().eval(), input_data=input_data)
Review comment:
No need to write a wrapper class. See
https://github.com/apache/incubator-tvm/blob/86079479f0556002adfce2f438ea2a607e318c23/tests/python/frontend/pytorch/test_forward.py#L704-L732
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services