| Files | Last commit | Last update |
|---|---|---|
| 13 days ago | ||
| 1 month ago | ||
| 1 month ago | ||
| 4 months ago | ||
| 14 days ago | ||
| 27 days ago | ||
| 1 month ago | ||
| 26 days ago | ||
| 1 month ago | ||
| 5 days ago |
Sort
English | 简体中文
Product Support Status
| Product | Supported |
|---|---|
| Ascend 950PR&950DT products | √ |
| Atlas A3 products | √ |
| Atlas A2 products | √ |
| Atlas 200I/500 A2 inference products | × |
| Atlas inference products | √ |
| Atlas training products | √ |
Function Description
-
Operator function: sorts the elements in the input tensor along the specified dimension in ascending or descending order, and returns the corresponding sorted values and index values.
-
Computation formula:
y1=sort(x,axis,descending,stable)y1 = \operatorname{sort}(x, \text{axis}, \text{descending}, \text{stable})
y2=argsort(x,axis,descending,stable)y2 = \operatorname{argsort}(x, \text{axis}, \text{descending}, \text{stable})
Parameter Description
| Parameter Name | Input/Output/Attribute | Description | Data Type | Data Format |
|---|---|---|---|---|
| x | Input | Input tensor to be sorted. | FLOAT16, FLOAT32, INT8, INT16, INT32, INT64, UINT8, UINT16, UINT32, UINT64, BFLOAT16 | ND |
| y1 | Output | Denotes the sorted values of the tensor along the specified dimension. It has the same type and format as x. | FLOAT16, FLOAT32, INT8, INT16, INT32, INT64, UINT8, UINT16, UINT32, UINT64, BFLOAT16 | ND |
| y2 | Output | Denotes the index of each element in the original tensor after sorting. | INT32, INT64 | ND |
| axis | Attribute | Dimension along which the elements are sorted. The default value is -1 (the last dimension). | INT | - |
| descending | Attribute | Whether to sort in descending order. true indicates descending order, and false indicates ascending order. The default value is false. | BOOL | - |
| stable | Attribute | Whether to perform stable sorting. true indicates stable sorting, and false indicates unstable sorting. The default value is false. | BOOL | - |
| y2_dtype | Attribute | Data type of y2. The default value is DT_INT32. | Type | - |
Constraint Description
None
Invocation Description
| Invocation Method | Invocation Sample | Description |
|---|---|---|
| aclnn invocation | test_aclnn_sort | Invokes the Sort operator through the aclnnSort API. |
| aclnn invocation | test_aclnn_argsort | Invokes the Sort operator through the aclnnArgsort API. |