polar

paddle. polar ( abs, angle, name=None ) [source]

Return a Cartesian coordinates corresponding to the polar coordinates complex tensor given the abs and angle component.

Parameters
  • abs (Tensor) – The abs component. The data type should be ‘float32’ or ‘float64’.

  • angle (Tensor) – The angle component. The data type should be the same as abs.

  • 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 abs and angle.

Return type

Tensor

Note

paddle.polar supports broadcasting. If you want know more about broadcasting, please refer to Introduction to Tensor .

Examples

>>> import paddle
>>> import numpy as np

>>> abs = paddle.to_tensor([1, 2], dtype=paddle.float64)
>>> angle = paddle.to_tensor([np.pi / 2, 5 * np.pi / 4], dtype=paddle.float64)
>>> out = paddle.polar(abs, angle)
>>> print(out)
Tensor(shape=[2], dtype=complex128, place=Place(cpu), stop_gradient=True,
[ (6.123233995736766e-17+1j)             ,
 (-1.4142135623730954-1.414213562373095j)])