polar
- paddle. polar ( abs: Tensor, angle: Tensor, name: Optional[str] = None, *, out: Optional[Tensor] = None ) Tensor [source]
-
Return a Cartesian coordinates corresponding to the polar coordinates complex tensor given the
absandanglecomponent.- 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|None, optional) – For details, please refer to api_guide_Name. Generally, no setting is required. Default: None.
out (Tensor, optional) – The output tensor. If set, the result will be stored in this tensor. Default is None.
- Returns
-
Tensor, The output tensor. The data type is ‘complex64’ or ‘complex128’, with the same precision as
absandangle.
Note
paddle.polarsupports 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)])
