- 博客(1)
- 收藏
- 关注
原创 Pytorch中的torch.gather()函数
参数说明以官方说明为例,gather()函数需要三个参数,输入input,输出dim,以及索引indexinput必须为Tensor类型dim为int类型,代表从哪个维度进行索引index为LongTensor类型举例说明input=torch.tensor([[1,2,3],[4,5,6]]) #作为输入index1=torch.tensor([[0,1,1],[0,1,1]]) #作为索引矩阵# dim=0时,按列进行索引print (torch.gather(i
2021-11-12 18:58:07
1406
1
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人