Unverified Commit de0869de by pyjhzwh Committed by GitHub

Fix stride default value None in torch.nn.functional.avg_pool (#4984)

* fix unordered dictionary problem for python version 3.5

* modify style

* default value of stride in torch.nn.functional.avg_pool is None

* delete prev modifications

* add testcase for nn.functional.avg_pool2d
parent e5044cb9
......@@ -470,7 +470,10 @@ def _avg_pool2d():
data = inputs[0]
pool_size = _infer_shape(inputs[1])
if inputs[2]:
strides = _infer_shape(inputs[2])
else:
strides = pool_size
padding = _infer_shape(inputs[3])
ceil_mode = int(inputs[4])
......
......@@ -375,8 +375,13 @@ def test_forward_avgpool():
def forward(self, *args):
return torch.nn.AvgPool2d(kernel_size=[10, 10])(args[0])
class AvgPool2D2(Module):
def forward(self, *args):
return torch.nn.functional.avg_pool2d(args[0], kernel_size=[10, 10])
input_data = torch.rand(input_shape).float()
verify_model(AvgPool2D1().float().eval(), input_data=input_data)
verify_model(AvgPool2D2().float().eval(), input_data=input_data)
def test_forward_hardtanh():
torch.set_grad_enabled(False)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment