is_floating_point

paddle. is_floating_point ( x ) [source]

Returns whether the dtype of x is one of paddle.float64, paddle.float32, paddle.float16, and paddle.bfloat16.

Parameters

x (Tensor) – The input tensor.

Returns

True if the dtype of x is floating type, otherwise false.

Return type

bool

Examples

import paddle

x = paddle.arange(1., 5., dtype='float32')
y = paddle.arange(1, 5, dtype='int32')
print(paddle.is_floating_point(x))
# True
print(paddle.is_floating_point(y))
# False