Solved by ptrblck in post #2 
              
              
                Do the small windows overlap? If so, you would have to think about a method to unite them (summing, mean, etc.). 
If not, you could try the following: 
channels = 1
h, w = 12, 12
image = torch.randn(1, channels, h, w)

kh, kw = 3, 3 # kernel size
dh, dw = 3, 3 # stride

patches = image.unfold(2, kh,…