Sort

Function Usage

Image processing algorithm, tensor sorting operation (Sort). The float16, float32, and uint8 data types are supported by input and output tensors. Asynchronous calling is supported. Preloading is supported. (The attr attribute needs to be added during preloading. For details, see Example of the Preloading File of the Initialization Operator.) The inplace operation is not supported.

It is supported by the Atlas inference product and Atlas 200I/500 A2 inference product.

The following conditions must be met:

Prototype

1
APP_ERROR Sort(const Tensor &src, Tensor &dst, int axis, bool descending, AscendStream& stream = AscendStream::DefaultStream());

Parameters

Parameter

Input/Output

Description

src

Input

Tensor class, input tensor. The float16, float32, or uint8 data types are supported. Only the HW dimension input is supported.

dst

Output

Tensor class, output tensor. The tensor content refers to the result after sorting. Only the float16, float32, and uint8 types of output are supported. Empty tensors can be passed. If dst is not an empty tensor, call Tensor.Malloc() to allocate memory in advance.

axis

Input

Specifies the sorting dimension. The value range is [0, 1]. 0 indicates that data is sorted by height, and 1 indicates that data is sorted by width.

descending

Input

Ascending or descending order. The default value is false, indicating the ascending order.

stream

Input

AscendStream type. The default value is AscendStream::DefaultStream(). When the parameter value is the default value, the API calling is a synchronous operation. In other cases, the API calling is an asynchronous operation.

Response Parameters

Data Structure

Description

APP_ERROR

For details about the returned error codes, see APP_ERROR Description.