torch 的 dim 和 numpy 的axis 表示方向不同
1. torch中以index_select为例子
torch.index_select(input, dim, index, out=None)
- 功能:在维度dim上,按index索引数据
- 返回值:依index索引数据拼接的张量
- index:要索引的张量
- dim:要索引的维度
- index:要索引数据的序号
x = torch.randn(3, 4)
print(x)
indices = torch.tensor([0, 2])
torch.index_s...
原创
2021-07-22 11:58:00 ·
455 阅读 ·
1 评论