index_put_(input: Tensor, indices: list[Tensor] | tuple[Tensor, ...], values: Tensor, accumulate: bool = False)In-place variant of index_put: writes into input's storage.
The values land in input's own buffer, so a view of input (or
the tensor input is a view of) sees them, and input takes the
write's place in the autograd graph, as the engine's in-place ops do.
A leaf that requires grad is refused while autograd records — wrap the
write in lucid.no_grad, which leaves a Parameter a trainable
leaf.
Parameters
inputTensorDestination; written in place.
Per-axis index tensors (one per leading dimension of
input);
same contract as index_put.valuesTensorValues to write at the addressed positions; cast to
input's
dtype.accumulatebool= FalseWhen
True add to existing values (duplicate indices sum);
when False (default) overwrite — a duplicate index keeps the
last write on the CPU, and an unspecified one of its values on
Metal.Returns
TensorThe same input tensor, now holding the updated values.
Raises
RuntimeErrorIf
input is a leaf that requires grad and autograd is recording.