Pytorch Rolling Fenster

import torch

x = torch.arange(10)#tensor([ 0,  1,  2,  3,  4,  5,  6,  7,  8,  9])
x.unfold(0,4,3) #Tensor.unfold(dimension, window_size, step) 

'''tensor([[0, 1, 2, 3],
        [3, 4, 5, 6],
        [6, 7, 8, 9]])'''
pythonized