Implementing kernel
C++ engine symbols that back this Python API.Select slices of input along dim given index.
Unlike gather, the index is a 1-D tensor and the output
preserves all axes of input — only dim changes size to
len(index).
Parameters
Returns
TensorTensor with the same shape as input except size
len(index) along dim.
Notes
Equivalent to input[..., index, ...] with the slice placed at
position dim. Reordering, duplication and subsetting are all
supported in one call.
Examples
>>> import lucid
>>> x = lucid.tensor([[1, 2], [3, 4], [5, 6]])
>>> lucid.index_select(x, dim=0, index=lucid.tensor([0, 2]))
Tensor([[1, 2],
[5, 6]])