Log

Function Usage

Image processing algorithm, tensor natural logarithm operation (Log). The float16 and float32 data types are supported. Asynchronous calling is supported. Preloading is supported. 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:

  • The input and output tensors must be on the device or DVPP side, and the parameters (stream and data memory) must be on the same device.
  • For synchronization, the device where the data memory is located must be the same as the initialized device.
  • The input and output parameters cannot exceed four dimensions, and must match the tensor shapes and types.
  • For the Atlas inference product, when the tensor size is greater than 480p (640 x 480), the compute performance of Log is better than that of cv::log on the CPU.
  • For the Atlas 200I/500 A2 inference product, when the input size is greater than 720p (1280 x 720), the compute performance is better than that of cv::log on the CPU.

Prototype

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

Parameters

Parameter

Input/Output

Description

src

Input

Tensor class, input tensor, supporting the float16 and float32 data types. When the element value of the input tensor is 0, its output tensor value element is -inf.

dst

Output

Tensor class, output tensor, supporting float16 and float32 data types. An empty tensor can be passed. If dst is not an empty tensor, call Tensor.Malloc() to allocate memory in advance.

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.