is_integer

paddle. is_integer ( x ) [source]

Return whether x is a tensor of integral data type.

Parameters

x (Tensor) – The input tensor.

Returns

True if the data type of the input is integer data type, otherwise false.

Return type

bool

Examples

>>> import paddle

>>> x = paddle.to_tensor([1 + 2j, 3 + 4j])
>>> print(paddle.is_integer(x))
False

>>> x = paddle.to_tensor([1.1, 1.2])
>>> print(paddle.is_integer(x))
False

>>> x = paddle.to_tensor([1, 2, 3])
>>> print(paddle.is_integer(x))
True