mindspore.ops.Real

class mindspore.ops.Real[source]

Returns a Tensor that is the real part of the input.

Inputs:
  • input (Tensor, complex) - The input tensor. types: complex64, complex128.

Outputs:

Tensor, has the float type.

Raises

TypeError – If the dtype of input is not one of: complex64, complex128.

Supported Platforms:

GPU

Examples

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