code: def cart2pol(
      x: Tensor, y: Tensor, eps: float = 1.0e-8
  ) -> tuple[Tensor, Tensor]:
      """Function that converts cartesian coordinates to polar coordinates.
  
      Args:
          x: Tensor of arbitrary shape.
          y: Tensor of same arbitrary shape.
          eps: To avoid division by zero.
  
      Returns:
          - rho: Tensor with same shape as input.
          - phi: Tensor with same shape as input.
  
      Example:
          >>> x = torch.rand(1, 3, 3)
          >>> y = torch.rand(1, 3, 3)
          >>> rho, phi = cart2pol(x, y)
      """
      if not (isinstance(x, Tensor) & isinstance(y, Tensor)):
          raise TypeError(
              f"Input type is not a Tensor. Got {type(x)}, {type(y)}"
          )
  
      rho = torch.sqrt(x**2 + y**2 + eps)
      phi = torch.atan2(y, x)
      return rho, phi
  
imports: from __future__ import annotations
  from typing import Optional
  import torch
  import torch.nn.functional
  from kornia.constants import pi
  from kornia.core import Tensor, concatenate, cos, pad, sin, stack, tensor, where, zeros_like
  from kornia.core.check import KORNIA_CHECK, KORNIA_CHECK_SHAPE
  from kornia.utils import deprecated
  from kornia.utils.helpers import _torch_inverse_cast
label_desc: Use image node_id 4 for calling a global function with example usage: cart2pol(x, y, eps) and returns: rho,  phi