Rate this Page

torch.Tensor.index_put_#

Tensor.index_put_(indices,values,accumulate=False)Tensor#

Puts values from the tensorvalues into the tensorself usingthe indices specified inindices (which is a tuple of Tensors). Theexpressiontensor.index_put_(indices,values) is equivalent totensor[indices]=values. Returnsself.

Ifaccumulate isTrue, the elements invalues are added toself. If accumulate isFalse, the behavior is undefined if indicescontain duplicate elements.

Parameters:
  • indices (tuple ofLongTensor) – tensors used to index intoself.

  • values (Tensor) – tensor of same dtype asself.

  • accumulate (bool) – whether to accumulate into self