图解pytorch里面的torch.gather()
上图显示了 torch gather() 函数在 dim=1 的二维张量上的工作。这里索引张量的行对应于输入张量的行(用灰色阴影突出显示)。现在对于索引张量中的每个索引值,从该行和输入张量的索引中选取相应的值。torch.gather(input=tensor2, dim=1, index = torch.tensor([[2, 1, 0], &nbs