高阶操作
1.where
cond条件函数
torch.where(condition,x,y)→Tensor
where成立时取x对应位置的值,否则取y
2.Gather查表
torch.gather(input,dim,index,out=None)→Tensor
input:查表的字典表
dim:查的维度
index:需要查的索引
输出为所查index的对应input元素
高阶操作
1.where
cond条件函数
torch.where(condition,x,y)→Tensor
where成立时取x对应位置的值,否则取y
2.Gather查表
torch.gather(input,dim,index,out=None)→Tensor
input:查表的字典表
dim:查的维度
index:需要查的索引
输出为所查index的对应input元素