pytorch / 2 / generated / torch.tensor.index_put_.html

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

© 2024, PyTorch Contributors
PyTorch has a BSD-style license, as found in the LICENSE file.
https://pytorch.org/docs/2.1/generated/torch.Tensor.index_put_.html