Skip to main content

//clika-runtime/io.clika.runtime/Ops/scatter

scatter

[common]
fun scatter(input: Tensor, dim: Long, index: Tensor, src: Tensor): Tensor

scatter(input: Tensor, dim: Long, index: Tensor, src: Tensor): the scatter operator. A copy of input with src written at positions given by index along dim, the write mirror of gather: out[index[p]][j][k] = src[p] for dim = 0 (only that axis's coordinate is redirected). A scalar src broadcasts one value to every indexed position; a tensor src matches index's shape. On duplicate destinations one write wins; use scatter_add / scatter_reduce for well-defined accumulation. Index dtype law as gather.

[common]
fun scatter(input: Tensor, dim: Long, index: Tensor, src: Double): Tensor

scatter(input: Tensor, dim: Long, index: Tensor, src: Double): the number form of scatter, src as a scalar.