mindspore.ops.Imag

class mindspore.ops.Imag[源代码]

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

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

Outputs:

Tensor, the shape is the same as the input.

Raises

TypeError – If the input is not a Tensor.

Supported Platforms:

GPU CPU

Examples

>>> x = Tensor(np.asarray(np.complex(1.3+0.4j)), mindspore.complex64)
>>> imag = ops.Imag()
>>> output = imag(x)
>>> print(output)
0.4