Implementing kernel
C++ engine symbols that back this Python API.Gather values along dim according to index.
For each output position the value is read from input with
index substituted for the dim-th coordinate. All other
coordinates are inherited from the output position itself — a
"row-wise" lookup. Tensor.gather(dim, index) is the same op.
Parameters
Returns
TensorTensor with the same shape as index.
Notes
Mathematically,
Inverse op is scatter.
Examples
>>> import lucid
>>> x = lucid.tensor([[1, 2, 3], [4, 5, 6]])
>>> idx = lucid.tensor([[0, 2], [1, 1]])
>>> lucid.gather(x, 1, idx)
tensor([[1, 3], [5, 5]], dtype=lucid.int64)