Hi,
I think this link is what you want.
In this case, I try the following code:
input = torch.tensor([[[1,2],
[3,4]],
[[5,6],
[7,8]],
[[9,10],
[11,12]],
[[13,14],
[15,16]]])
input = input.view(1,4,4) # 1 is used to fix the dim needed
output = input.unfold(2,2,2).unfold(3,2,2)
output = output.contiguous().view(4,4)