fn
scatter_op
→TensorImplPtrint scatter_op(const int & base, int dim, const int & indices, const int & src)Python wrappers
Public Python APIs implemented by this engine symbol.Overwrite-semantics scatter: .
Composite over gather_op + sub_op + scatter_add_op.
The overwrite is encoded as a scatter-add of the delta
, so the result is identical
to assignment but reuses the existing additive scatter kernel. Gradient
flows through ScatterAddBackward, SubBackward, and
GatherBackward.
Math
See Also
scatter_add_op — additive variant; canonical primitive.
Parameters
baseTensorImplPtrTensor to scatter into. Provides the output shape and dtype.
dimintAxis along which
indices selects.indicesTensorImplPtrInteger tensor (
int32 or int64) with the same shape as src.srcTensorImplPtrSource values written into
base at the positions given by indices.Returns
TensorImplPtrA new tensor with the same shape and dtype as base.
Raises
FailureIf any input is null or
indices is not an integer dtype.IndexErrorIf
dim is out of range.Notes
Duplicate indices yield undefined ordering — the last write wins
guarantee of true scatter is not preserved here because the underlying
primitive is additive. Use disjoint indices for deterministic
behaviour.