I have the following code:
x = (torch.arange(16)+1).reshape(1,1,4,4).float()
im2col = F.unfold(x, (2,2))

with the x being:
1   2  3   4
5   6  7   8
9  10 11  12
13 14 15  16

I expect the this to have an output of
[[1,2,5,6],
 [2,3,6,7],
 [3,4,7,8],
 .....]

but it is giving me the output of kernel size 3:
[[1,2,3,5,6,7,9,10,11],
 [2,3,4,6,7,8,10,11,12],
 .....]

Am I thinking wrong about the unfold operation? and is this the expected behavior? When so, can you elaborate?