# mlx.core.argsort — MLX 0.0.7 documentation

Skip to main content
`Ctrl`+`K`

# mlx.core.argsort

mlx.core.argsort(a: array, /, axis: Union[ None , int ] = - 1, *, stream: Union[ None , Stream , Device ] = None) → array

  Returns the indices that sort the array.

  Parameters:

    - a (array) – Input array.

    - axis (int or None, optional) – Optional axis to sort over. If `None`, this sorts over the flattened array. If unspecified, it defaults to -1 (sorting over the last axis).

  Returns:

    The indices that sort the input array.

  Return type:

    array