IsFinite
Applicability
Product |
Supported |
|---|---|
Atlas 350 Accelerator Card |
√ |
x |
|
x |
|
x |
|
x |
|
x |
|
x |
Function Usage
Checks whether the input floating-point number is a non-NAN or non-±INF value. The output is a floating-point number or Boolean value. For non-NAN or non-±INF input, if the output is of the floating-point type, the result of the corresponding position is 1 of the floating-point type. If not, the result is 0. If the output is of the Boolean type, the result of the corresponding position is true. If not, the result is false. The formula is as follows:

Prototype
1 2 | template<typename T, typename U> __aicore__ inline void IsFinite(const LocalTensor<U>& dst, const LocalTensor<T>& src, uint32_t calCount) |
Parameters
Parameter |
Description |
|---|---|
T |
Data type of the source operand. For the Atlas 350 Accelerator Card, the supported data types are half, bfloat16_t, and float. |
U |
Data type of the destination operand. For the Atlas 350 Accelerator Card, the supported data types are bool, half, bfloat16_t, and float. |
Parameter |
Input/Output |
Description |
|---|---|---|
dst |
Output |
Destination operand. The type is LocalTensor, and TPosition can be VECIN, VECCALC, or VECOUT. The data type of the destination operand is the same as that of the source operand, or the data type of the destination operand is bool. For details about the supported data type groups, see Table 3. |
src |
Input |
Source operand. The type is LocalTensor, and TPosition can be VECIN, VECCALC, or VECOUT. |
calCount |
Input |
Number of elements involved in the computation. |
Returns
None
Constraints
- The source operand address must not overlap the destination operand address.
- For details about the alignment requirements of the operand address offset, see General Description and Restrictions.
Examples
For details about the complete operator example, see isfinite operator sample.
1 2 3 4 | // dstLocal: tensor for storing the IsFinite computation result // srcLocal: input tensor for storing data for IsFinite computation // The number of elements involved in the computation is 8. AscendC::IsFinite(dstLocal, srcLocal, 8); |
1 2 3 4 5 | The input data type is float, and the output data type is bool. Input (src): [1.0,+inf,3.0,4.0,nan,6.0,-inf,8.0] Output (dst): [true,false,true,true,false,true,false,true] |

