Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

pytorch rolling window

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]])'''
 
PREVIOUS NEXT
Tagged: #pytorch #rolling #window
ADD COMMENT
Topic
Name
2+2 =