MinMaxLoc

Function Usage

Image processing algorithm, which is used to calculate the maximum and minimum values of tensors and their positions. The data types float16, float32, and uint8 are supported. Asynchronous calling is supported.

Only Atlas inference product support this API.

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 tensor must have two or three dimensions (one channel), and the output tensor must have one dimension. The number of elements in minVal and maxVal must be 1, and the number of elements in minLoc and maxLoc must be 2.

Prototype

1
APP_ERROR MinMaxLoc(const Tensor &src, Tensor &minVal, Tensor &maxVal, Tensor &minLoc, Tensor &maxLoc, AscendStream &stream = AscendStream::DefaultStream());

Parameters

Parameter

Input/Output

Description

src

Input

Tensor class, input tensor, supporting the float16, float32, and uint8 data types.

minVal

Output

Tensor class, minimum value, output tensor. The data type is the same as that of src. An empty tensor can be passed. If minVal is not empty, call Tensor.Malloc() to allocate memory in advance.

maxVal

Output

Tensor class, maximum value, output tensor. The data type is the same as that of src. An empty tensor can be passed. If maxVal is not empty, call Tensor.Malloc() to allocate memory in advance.

minLoc

Output

Tensor class, position index of the minimum value. The data type is uint32. An empty tensor can be passed. If minLoc is not empty, call Tensor.Malloc() to allocate memory in advance.

maxLoc

Output

Tensor class, position index of the maximum value. The data type is uint32. An empty tensor can be passed. If maxLoc is not empty, 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.