[GitHub] [incubator-tvm] wyc-ruiker commented on a change in pull request #5142: [Torch] Add support for max_pool1d
wyc-ruiker commented on a change in pull request #5142: [Torch] Add support for max_pool1d URL: https://github.com/apache/incubator-tvm/pull/5142#discussion_r397132458 ## 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): Review comment: done. 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-tvm] wyc-ruiker commented on a change in pull request #5142: [Torch] Add support for max_pool1d
wyc-ruiker commented on a change in pull request #5142: [Torch] Add support for max_pool1d URL: https://github.com/apache/incubator-tvm/pull/5142#discussion_r397132370 ## 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: done. 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-tvm] wyc-ruiker commented on a change in pull request #5142: [Torch] Add support for max_pool1d
wyc-ruiker commented on a change in pull request #5142: [Torch] Add support for max_pool1d URL: https://github.com/apache/incubator-tvm/pull/5142#discussion_r397124944 ## 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): Review comment: > I am talking about the same point as https://github.com/apache/incubator-tvm/pull/5142/files#r397046667 > > Yes, you should have a test, but no need to write a wrapper class Thanks. I misunderstood your review suggestion :-) 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-tvm] wyc-ruiker commented on a change in pull request #5142: [Torch] Add support for max_pool1d
wyc-ruiker commented on a change in pull request #5142: [Torch] Add support for max_pool1d URL: https://github.com/apache/incubator-tvm/pull/5142#discussion_r397074587 ## 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): Review comment: Don't we need a test for padding and stride in Maxpool? 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-tvm] wyc-ruiker commented on a change in pull request #5142: [Torch] Add support for max_pool1d
wyc-ruiker commented on a change in pull request #5142: [Torch] Add support for max_pool1d URL: https://github.com/apache/incubator-tvm/pull/5142#discussion_r397074097 ## 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): Review comment: Don't we need a test for padding and stride in Maxpool? 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-tvm] wyc-ruiker commented on a change in pull request #5142: [Torch] Add support for max_pool1d
wyc-ruiker commented on a change in pull request #5142: [Torch] Add support for max_pool1d URL: https://github.com/apache/incubator-tvm/pull/5142#discussion_r397074097 ## 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): Review comment: Don't we need a test for padding and stride in Maxpool? 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-tvm] wyc-ruiker commented on a change in pull request #5142: [Torch] Add support for max_pool1d
wyc-ruiker commented on a change in pull request #5142: [Torch] Add support for max_pool1d URL: https://github.com/apache/incubator-tvm/pull/5142#discussion_r397073052 ## File path: python/tvm/relay/frontend/pytorch.py ## @@ -213,12 +213,33 @@ def _impl(inputs, input_types): pool_size = _infer_shape(inputs[1]) strides = _infer_shape(inputs[2]) padding = _infer_shape(inputs[3]) - +dilation = _infer_shape(inputs[4]) Review comment: In https://pytorch.org/docs/stable/nn.html#maxpool1d, MaxPool1d and MaxPool2d have dilation argument. 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-tvm] wyc-ruiker commented on a change in pull request #5142: [Torch] Add support for max_pool1d
wyc-ruiker commented on a change in pull request #5142: [Torch] Add support for max_pool1d URL: https://github.com/apache/incubator-tvm/pull/5142#discussion_r397071431 ## File path: src/relay/op/nn/pooling.cc ## @@ -987,6 +987,10 @@ Array Pool1DCompute(const Attrs& attrs, << " or 4-D input (e.g. NCWc on for vector instructions)" << " or 5-D input (e.g. NCWnc for tensor accelerators)"; + if (param->padding.size() == 1) { +padding.push_back(padding[0]); Review comment: Yes, If we don't have this, the max_pool1d will fail in https://github.com/apache/incubator-tvm/blob/7c5ff50873e91e9ad27b5f08847c27d58e8b5c4c/topi/include/topi/nn/pooling.h#L679-L680 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: us...@infra.apache.org With regards, Apache Git Services