Skip to main content

//clika-runtime/io.clika.runtime/Ops/gather

gather

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

gather(input: Tensor, dim: Long, index: Tensor): the gather operator. Axis-wise gather: read input at positions given by index along dim. out[i][j][k] = x[index[i][j][k]][j][k] for dim = 0 (likewise for any other dim; only that axis's coordinate is replaced). The output takes index's shape and input's dtype. Index tensors are Int32 or Int64 on every backend; entries must lie in [0, x's dim extent).