torch.Tensor.index_put_¶
- Tensor.index_put_(indices, values, accumulate=False) Tensor ¶
将张量
values
中的值放入张量self
中,使用的索引在indices
中指定(indices
是一个由张量组成的元组)。表达式tensor.index_put_(indices, values)
等同于tensor[indices] = values
。返回self
。如果
accumulate
为True
,则将values
中的元素添加到self
中。如果accumulate
为False
,并且indices
包含重复元素,则行为是未定义的。