Shortcuts

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

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources