mindspore.ops.Real

class mindspore.ops.Real[源代码]

Returns a Tensor that is the real part of the input. If input is real, it is returned unchanged.

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:

CPU GPU

Examples

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