min

Applicability

Product

Supported

Atlas A3 training products/Atlas A3 inference products

Atlas A2 training products/Atlas A2 inference products

Atlas 200I/500 A2 inference products

x

Atlas inference product's AI Core

Atlas inference product's Vector Core

x

Atlas training products

x

Function

Compares two numbers of the same data type and returns the minimum value.

Prototype

1
2
template <typename T, typename U>
__aicore__ inline T min(const T src0, const U src1)

Parameters

Table 1 Template parameters

Parameter

Description

T

Data type of the input data src0. Currently, the following data types are supported:

bool, int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, float, int64_t, uint64_t.

U

Data type of the input data src1. Currently, the following data types are supported:

bool, int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, float, int64_t, uint64_t.

Reserved type. Currently, the value must be the same as that of T.

Table 2 API parameters

Parameter

Input/Output

Description

src0

Input

Source operand. This is the input for comparison.

src1

Input

Source operand. This is the input for comparison.

Restrictions

The data types of the two source operands must be the same.

Returns

Minimum value of the two input data elements.

Example

1
2
3
4
5
int64_t src0 = 1;
int64_t src1 = 2;
 
int64_t result = AscendC::Std::min(src0, src1); 
// result: 1