mindspore.ops.is_complex

mindspore.ops.is_complex(input)[source]

Return True if the data type of the tensor is complex, otherwise return False.

Parameters

input (Tensor) – The input tensor.

Returns

Bool, return whether the data type of the tensor is complex.

Raises

TypeError – If input is not a Tensor.

Supported Platforms:

Ascend GPU CPU

Examples

>>> from mindspore import ops, Tensor
>>> from mindspore import dtype as mstype
>>> input = Tensor([1, 1+1j, 2+2j], mstype.complex64)
>>> output = ops.is_complex(input)
>>> print(output)
True