- 博客(1)
- 收藏
- 关注
原创 Pytorch中的torch.gather()函数
参数说明 以官方说明为例,gather()函数需要三个参数,输入input,输出dim,以及索引index input必须为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
1417
1
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人