mindspore.mint.argsort
- mindspore.mint.argsort(input, dim=- 1, descending=False, stable=False)[source]
Return the indices that sort the tensor along the specified dimension.
Warning
This is an experimental API that may change or be removed.
- Parameters
input (Tensor) – The input tensor.
dim (int, optional) – Specify the dimension to sort along. Default
-1. The Ascend backend only supports sorting the last dimension.descending (bool, optional) – Sort order(ascending or descending).Default
False.stable (bool, optional) – Control the relative order of equivalent elements. Default
False.
- Returns
Tensor
- Supported Platforms:
Ascend
Examples
>>> import mindspore >>> x = mindspore.tensor([[8, 2, 1], [5, 9, 3], [4, 6, 7]], mindspore.float16) >>> sort = mindspore.mint.argsort(x) >>> print(sort) [[2 1 0] [2 0 1] [0 1 2]]