Implementing kernel
C++ engine symbols that back this Python API.Gather values along dim according to indices.
For each output position the value is read from input with
indices substituted for the dim-th coordinate. All other
coordinates are inherited from the output position itself — a
"row-wise" lookup.
Parameters
Returns
TensorTensor with the same shape as indices.
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, idx, dim=1)
Tensor([[1, 3],
[5, 5]])