IsFloatingType

Function Usage

Checks whether the input data is of floating-point type, including Float64 (Double), Float32 (Float), BFloat16, and Float16.

Prototype

bool IsFloatingType(const DataType dtype)

Parameters

Parameter

Input/Output

Description

dtype

Input

Input data type.

Returns

true: floating-point; false: otherwise.

Constraints

None

Example

1
2
3
4
5
6
// If dtype is not a floating-point number, a return statement is executed.
void Func(const DataType dtype) {
    if (!IsFloatingType(dtype)) {
        return;
    }
}