megengine.functional.polar

polar(abs, angle)[source]

Constructs a complex tensor whose elements are Cartesian coordinates corresponding to the polar coordinates with absolute value abs and angle angle.

Parameters
  • abs (Tensor) – the absolute value the complex tensor. Must be float.

  • angle (Tensor) – the angle of the complex tensor. Must be float.

Return type

Tensor

Returns

the complex tensor

Examples

>>> abs = Tensor([1, 2], dtype=np.float32)
>>> angle = Tensor([np.pi / 2, 5 * np.pi / 4], dtype=np.float32)
>>> z = F.polar(abs, angle)
>>> z
Tensor([-4.3711e-08+1.j     -1.4142e+00-1.4142j], dtype=complex64, device=xpux:0)