Rate this Page

torch.Tensor.index_put_#

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 to tensor[indices] = values. Returns self.

If accumulate is True, the elements in values are added to self. If accumulate is False, the behavior is undefined if indices contain duplicate elements.

Parameters
  • indices (tuple of LongTensor) – tensors used to index into self.

  • values (Tensor) – tensor of same dtype as self.

  • accumulate (bool) – whether to accumulate into self