Solved by ptrblck in post #2 
              
              
                You could use tensor.unfold for it: 
out = x.unfold(1, window_size, 1)
out = out.squeeze(0).permute(0, 3, 1, 2)
print(out.shape) # torch.Size([8, 3, 60, 256])
print((out == new_x).all()) # tensor(True)