torch.index_put_(self, indices, value, accumulate)
我是使用这个函数时报错了,发现官方定义 indices 为 (tuple of LongTensor) ,而不是tensor类型。
为了把 tensor 转为 tuple 型,我为indices加了 ()
a.index_put_((indices), value).to(device)
然而,还是报这个错
后来知道,直接加 () 并不能将其转化为 tuple,而是 需要 (,)
a.index_put_((indices,), value).to(device)
总结:(,)才可转为tuple类型,而不是单纯的()