其他分享
首页 > 其他分享> > 花式索引原理浅析

花式索引原理浅析

作者:互联网

假设我有如下三维tensor:

matrix = torch.tensor([
    [
        [1,2,3],
        [4,5,6]
    ],
    [
        [2,3,4],
        [5,6,7]
    ]
])

索引方法为:

matrix[
    [
        [0],
        [1]
    ],
    [
        [0,1],
        [1,1]
    ],
    [
        [2,1],
        [1,2]
    ]
]

其索引过程为:

 

标签:matrix,torch,索引,浅析,花式,tensor
来源: https://www.cnblogs.com/hisi-tech/p/16472901.html