mindspore.ops.Imag

View Source On Gitee
class mindspore.ops.Imag[source]

Returns a new tensor containing imaginary value of the input. If input is real, it is returned zeros.

Inputs:
  • input (Tensor) - The input tensor.

Outputs:

Tensor, the shape is the same as the input.

Raises

TypeError – If the input is not a Tensor.

Supported Platforms:

Ascend GPU CPU

Examples

>>> import mindspore
>>> from mindspore import ops
>>> x = mindspore.tensor(1.3+0.4j, mindspore.complex64)
>>> imag = ops.Imag()
>>> output = imag(x)
>>> print(output)
0.4