megengine.functional.complex¶
- complex(real, imag)[源代码]¶
Constructs a complex tensor with its real part equal to real and its imaginary part equal to imag.
- 参数
- 返回类型
- 返回
the complex tensor
实际案例
>>> real = Tensor([1, 2], dtype=np.float32) >>> imag = Tensor([3, 4], dtype=np.float32) >>> z = F.complex(real, imag) >>> z Tensor([1.+3.j 2.+4.j], dtype=complex64, device=xpux:0) >>> z.dtype dtype('complex64')