Implementing kernel
C++ engine symbols that back this Python API.Return the indices that would sort input along dim.
Gathering input with the returned tensor along dim gives
sort's result.
Parameters
inputTensorSource tensor.
dimint= -1Axis along which to sort.
descendingbool= FalseOrder largest first.
Returns
TensorInteger index tensor of the same shape as input.
Notes
The sort is stable in both directions: equal keys keep their input order, descending included. NaN sorts as the largest value.
Examples
>>> import lucid
>>> x = lucid.tensor([3, 1, 4, 1, 5])
>>> lucid.argsort(x, dim=0)
Tensor([1, 3, 0, 2, 4])
>>> lucid.argsort(x, dim=0, descending=True)
Tensor([4, 2, 0, 1, 3])