19. Cartesian to Polar

Medium

Z is an (n, 2) tensor of (x, y) coordinates. Return an (n, 2) tensor of (R, T) where R = sqrt(x²+y²), T = atan2(y, x).

Input

tensor([[1., 0.],
        [0., 1.],
        [1., 1.]])

Output

tensor([[1.0000, 0.0000],
        [1.0000, 1.5708],
        [1.4142, 0.7854]])

Sign in to write and run your own code.

Implement solve(...)