is_complex

paddle. is_complex ( x: Tensor ) bool [source]

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

System Message: ERROR/3 (/usr/local/lib/python3.10/site-packages/paddle/tensor/attribute.py:docstring of paddle.tensor.attribute.is_complex, line 1)

Content block expected for the “note” directive; none found.

.. note::

System Message: WARNING/2 (/usr/local/lib/python3.10/site-packages/paddle/tensor/attribute.py:docstring of paddle.tensor.attribute.is_complex, line 1)

Explicit markup ends without a blank line; unexpected unindent.

Alias Support: The parameter name input can be used as an alias for x. For example, input=tensor_x is equivalent to x=tensor_x.

Parameters
  • x (Tensor) – The input tensor.

  • input – An alias for x , with identical behavior.

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