IsFloatingType

Description

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

Prototype

bool IsFloatingType(const ge::DataType type)

Parameters

Parameter

Input/Output

Description

type

Input

Input data type.

Returns

true: floating-point; false: otherwise.

Constraints

None

Examples

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