mindspore.ops.imag

mindspore.ops.imag(input)[source]

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

Parameters

input (Tensor) – The input tensor to compute to.

Returns

Tensor, the shape is the same as the input.

Raises

TypeError – If input is not a Tensor.

Supported Platforms:

Ascend GPU CPU

Examples

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