is_complex

paddle. is_complex ( x ) [source]

Return whether x is a tensor of complex data type(complex64 or complex128).

Parameters

x (Tensor) – The input tensor.

Returns

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

Return type

bool

Examples

>>> import paddle

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

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

>>> x = paddle.to_tensor([1, 2, 3])
>>> print(paddle.is_complex(x))
False