megengine.functional.real

real(complex)[source]

Returns a new tensor containing real values of the complex tensor.

Parameters

complex (Tensor) –

Return type

Tensor

Returns

the real part of the complex tensor

Examples

>>> x=Tensor([0.3100+0.3553j, -0.5445-0.7896j, -1.6492-0.0633j, -0.0638-0.8119j], dtype=np.complex64)
>>> F.real(x)
Tensor([[ 0.31  ]
 [-0.5445]
 [-1.6492]
 [-0.0638]], device=xpux:0)