Function burn::tensor::argsort

pub fn argsort<B, const D: usize, K>(
    tensor: <K as TensorKind<B>>::Primitive<D>,
    dim: usize,
    descending: bool,
) -> <B as Backend>::IntTensorPrimitive<D>
where B: Backend, K: TensorKind<B> + BasicOps<B>, <K as BasicOps<B>>::Elem: Element,
Expand description

Returns the indices that sort the elements of the input tensor along a given dimension.

This sort is unstable (i.e., may reorder equal elements).

§Arguments

  • tensor - The input tensor.
  • dim - The axis along which to sort.
  • descending - The sorting order.

§Returns

A tensor with the same shape as the input tensor the indices map back to the original input tensor.

§Remarks

This is a fallback solution that used only when the backend doesn’t have the corresponding implementation. Ideally, it is supposed to be implemented by the backend and the backend implementation will be resolved by static dispatch. It is not designed for direct usage by users, and not recommended to import or use this function directly.