IsIntegralType (Including Bool)

Note: This API will be deprecated in future releases. Use IsIntegralType (Including Bool) instead.

Description

Checks whether the input data is of integer type, including Int8, Int16, Int32, Int64, Uint8, Uint16, Uint32, and Uint64.

If include_bool is set to true, a bool is also included as an integer.

Prototype

bool IsIntegralType(const ge::DataType type, const bool include_bool)

Parameters

Parameter

Input/Output

Description

type

Input

Input data type.

include_bool

Input

Whether to include a bool as an integer.

Returns

true: integer; false: otherwise.

Constraints

None

Examples

1
2
3
4
5
6
// If dtype is not an integer, a return statement is executed. Here, a bool is included as an integer.
void Func(const ge::DataType type) {
    if (!IsIntegralType(type, true)) {
        return;
    }
}