SearchSorted
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: searches a sorted tensor sorted_sequence for the positions where the given tensor values should be inserted. It returns a tensor of the same size as values, where each element indicates the position where the given value should be inserted in the original tensor.
Parameter Description
| Parameter Name | Input/Output/Attribute | Description | Data Type | Data Format |
|---|---|---|---|---|
| sorted_sequence | Input | Input tensor. The values along its last dimension are sorted in ascending order. | FLOAT16, FLOAT, INT8, INT16, INT32, INT64, UINT8 | ND |
| values | Input | Tensor to be inserted. Its data type must be the same as that of the input sorted_sequence. Except for the last dimension, its other dimensions must be the same as those of sorted_sequence. | FLOAT16, FLOAT, INT8, INT16, INT32, INT64, UINT8 | ND |
| sorter | Optional input | Optional input tensor. Its shape is the same as that of the unsorted sorted_sequence, and it contains the index sequence that sorts sorted_sequence in ascending order along the innermost dimension. | INT64 | ND |
| dtype | Optional attribute |
• Specifies the data type of the output tensor. Only INT64 and INT32 are supported. • The default value is INT64. |
TYPE | - |
| right | Optional attribute |
• Optional Boolean value. false indicates that when identical values exist in the sequence and the insertion position is not unique, the insertion position is aligned to the left. true indicates that the insertion position is aligned to the right in this case. • The default value is false. |
BOOL | - |
| out | Output | Output tensor. Its shape is the same as that of the input values. | INT32, INT64 | ND |
Constraint Description
None
Invocation Description
| Invocation Method | Invocation Sample | Description |
|---|---|---|
| aclnn invocation | test_aclnn_search_sorted | Invokes the SearchSorted operator through the aclnnSearchSorted API. |
| aclnn invocation | test_aclnn_search_sorteds | Invokes the SearchSorted operator through the aclnnSearchSorteds API. |
| Graph-mode invocation | test_geir_search_sorted | Invokes the SearchSorted operator by building a graph through the operator IR. |