# tensorplay.functional.complex Source: https://www.tensorplay.cn/docs/generated/tensorplay.functional.complex.html ```python tensorplay.functional.complex(real, imag, *, out=None) → Tensor ``` Constructs a complex tensor with its real part equal to [real](/docs/generated/tensorplay.functional.real.html#tensorplay.functional.real) and its imaginary part equal to [imag](/docs/generated/tensorplay.functional.imag.html#tensorplay.functional.imag). Parameters: - real ([Tensor](/docs/generated/tensorplay.Tensor.html#tensorplay.Tensor)) – The real part of the complex tensor. Must be half, float or double. - imag ([Tensor](/docs/generated/tensorplay.Tensor.html#tensorplay.Tensor)) – The imaginary part of the complex tensor. Must be same dtype as [real](/docs/generated/tensorplay.functional.real.html#tensorplay.functional.real). Keyword Arguments: out ([Tensor](/docs/generated/tensorplay.Tensor.html#tensorplay.Tensor)) – If the inputs are tensorplay.float32, must be tensorplay.complex64. If the inputs are tensorplay.float64, must be tensorplay.complex128. Example: ``` >>> real = tensorplay.tensor([1, 2], dtype=tensorplay.float32) >>> imag = tensorplay.tensor([3, 4], dtype=tensorplay.float32) >>> z = tensorplay.complex(real, imag) >>> z tensor([(1.+3.j), (2.+4.j)]) >>> z.dtype tensorplay.complex64 ```