complex¶
- paddle. complex ( real, imag, name=None ) [source]
- 
         Return a compelx tensor given the real and image component. - Parameters
- 
           - real (Tensor) – The real component. The data type should be ‘float32’ or ‘float64’. 
- imag (Tensor) – The image component. The data type should be the same as - real.
- name (str, optional) – For details, please refer to Name. Generally, no setting is required. Default: None. 
 
- Returns
- 
           The output tensor. The data type is ‘complex64’ or ‘complex128’, with the same precision as realandimag.
- Return type
- 
           Tensor 
 - Note:
- 
           paddle.complexsupports broadcasting. If you want know more about broadcasting, please refer to user_guide_broadcasting .
 Examples import paddle x = paddle.arange(2, dtype=paddle.float32).unsqueeze(-1) y = paddle.arange(3, dtype=paddle.float32) z = paddle.complex(x, y) print(z) # Tensor(shape=[2, 3], dtype=complex64, place=Place(cpu), stop_gradient=True, # [[0j , 1j , 2j ], # [(1+0j), (1+1j), (1+2j)]]) 
