Abs

Function Usage

Obtains absolute values of tensors. The float16, float32, and uint8 data types are supported. Asynchronous calling is supported. The inplace operation is not supported.

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

For the Atlas 200I/500 A2 inference product, preloading is supported (see Example of the Preloading File of the Initialization Operator).

The following conditions must be met:

Prototype

1
APP_ERROR Abs(const Tensor &src, Tensor &dst, AscendStream& stream = AscendStream::DefaultStream());

Parameters

Parameter

Input/Output

Description

src

Input

Tensor class, input tensor, supporting the float16, float32, and uint8 data types. The data memory must be on the device or DVPP side.

dst

Output

Tensor class, output tensor, supporting the float16, float32, and uint8 data types. An empty tensor can be passed. If dst is not empty, the shape of dst must be the same as that of src. Call Tensor.Malloc() to allocate memory in advance. The data memory must be on the device (the same device as that of src) or DVPP.

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.