📜  pytorch 滚动窗口 - Python 代码示例

📅  最后修改于: 2022-03-11 14:47:02.652000             🧑  作者: Mango

代码示例1
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]])'''