Code:
import torch
import torch.nn.functional as F
from torch.autograd import Variable
x = torch.arange(0,9).view(1,1,3,3)
x = x.cuda().float()
o = F.avg_pool2d(Variable(x), kernel_size=3, stride=1, padding=1)
>>> x
(0 ,0 ,.,.) =
0 1 2
3 4 5
6 7 8
[torch.cuda.FloatTensor of size 1x1x3x3 (GPU 0)]
PyTorch ā0.5.0a0+d365158ā: (Github latest source as of 19-Jun-2018 8.57 IST) [WRONG]
o =
tensor([[[[2.0000, 2.5000, 3.0000],
[3.5000, 4.0000, 4.5000],
[5.0000, 5.5000, 6.0000]]]], device='cuda:0')
PyTorch ā0.1.12+6f6d70fā: [CORRECT]
o =
Variable containing:
(0 ,0 ,.,.) =
0.8889 1.6667 1.3333
2.3333 4.0000 3.0000
2.2222 3.6667 2.6667
[torch.cuda.FloatTensor of size 1x1x3x3 (GPU 0)]
It seems the old pytorch version(ā0.1.12+6f6d70fā) is giving the right behaviour. Does it mean the bug is re-introduced/files not synched?