torch.Tensor.index_put_ — PyTorch 2.7 documentation (original) (raw)
Tensor.index_put_(indices, values, accumulate=False) → Tensor¶
Puts values from the tensor values into the tensor self
using the indices specified in indices (which is a tuple of Tensors). The expression tensor.index_put_(indices, values)
is equivalent totensor[indices] = values
. Returns self
.
If accumulate
is True
, the elements in values are added toself
. If accumulate is False
, the behavior is undefined if indices contain duplicate elements.
Parameters