mindspore.ops.Polar
- class mindspore.ops.Polar[source]
Converts polar coordinates to Cartesian coordinates.
Refer to
mindspore.ops.polar()
for more details.- Inputs:
abs (Tensor) - Radial distance. Tensor of any dimension, must be one of the following types: float32, float64.
angle (Tensor) - Polar angle. It has the same shape and dtype as abs.
- Outputs:
Tensor, has the same shape and data type as abs.
- Supported Platforms:
GPU
CPU
Examples
>>> import mindspore >>> import numpy as np >>> from mindspore import Tensor, ops >>> polar = ops.Polar() >>> x1 = Tensor(np.array([1, 2]), mindspore.float64) >>> x2 = Tensor(np.array([3, 4]), mindspore.float64) >>> output = polar(x1, x2) >>> print(output) [-0.9899925 +0.14112001j -1.30728724-1.51360499j] >>> x1 = Tensor(2.1, mindspore.float32) >>> x2 = Tensor(2.1, mindspore.float32) >>> output = polar(x1, x2) >>> print(output) (-1.0601766+1.8127397j)