megengine.functional.imag

imag(complex)[源代码]

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

参数

complex (Tensor) –

返回类型

Tensor

返回

the imaginary part of the complex tensor

实际案例

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