-
Notifications
You must be signed in to change notification settings - Fork 26.3k
Description
🐛 Bug
Hi, it seems that pytorch 1.2 fixed a bug with ceil_mode in F. avg_pool2d() in previous versions of pytorch (at least 1.0 and 1.1). Particularly, before the default says ceil_mode=False but it seems to always be True. However, I wonder if the default behavior in pytorch 1.2 should be set to ceil_mode=True for backward consistency with 1.1 and 1.0.
To Reproduce
import torch
import torch.nn
import torch.nn.functional
x = torch.ones(1,3,2,2)
print('default ceil_mode', torch.nn.functional.avg_pool2d(x, 4).shape)
print('ceil_mode=True', torch.nn.functional.avg_pool2d(x, 4, stride=4, padding=0, ceil_mode=True, count_include_pad=True).shape)
print('ceil_mode=False', torch.nn.functional.avg_pool2d(x, 4, stride=4, padding=0, ceil_mode=False, count_include_pad=True).shape)
torch 1.1
default ceil_mode torch.Size([1, 3, 1, 1])
ceil_mode=True torch.Size([1, 3, 1, 1])
ceil_mode=False torch.Size([1, 3, 1, 1])
torch 1.2
Traceback (most recent call last):
File "", line 1, in
RuntimeError: Given input size: (3x2x2). Calculated output size: (3x0x0). Output size is too small
ceil_mode=True torch.Size([1, 3, 1, 1])
Traceback (most recent call last):
File "", line 1, in
RuntimeError: Given input size: (3x2x2). Calculated output size: (3x0x0). Output size is too small