code: def rgb_to_hsv(
      image: torch.Tensor, eps: float = 1e-8
  ) -> torch.Tensor:
      r"""Convert an image from RGB to HSV.
  
      .. image:: _static/img/rgb_to_hsv.png
  
      The image data is assumed to be in the range of (0, 1).
  
      Args:
          image: RGB Image to be converted to HSV with shape of :math:`(*, 3, H, W)`.
          eps: scalar to enforce numarical stability.
  
      Returns:
          HSV version of the image with shape of :math:`(*, 3, H, W)`.
          The H channel values are in the range 0..2pi. S and V are in the range 0..1.
  
      .. note::
         See a working example `here <https://kornia.github.io/tutorials/nbs/color_conversions.html>`__.
  
      Example:
          >>> input = torch.rand(2, 3, 4, 5)
          >>> output = rgb_to_hsv(input)  # 2x3x4x5
      """
      if not isinstance(image, torch.Tensor):
          raise TypeError(
              f"Input type is not a torch.Tensor. Got {type(image)}"
          )
  
      if len(image.shape) < 3 or image.shape[-3] != 3:
          raise ValueError(
              f"Input size must have a shape of (*, 3, H, W). Got {image.shape}"
          )
  
      max_rgb, argmax_rgb = image.max(-3)
      min_rgb, argmin_rgb = image.min(-3)
      deltac = max_rgb - min_rgb
  
      v = max_rgb
      s = deltac / (max_rgb + eps)
  
      deltac = torch.where(deltac == 0, torch.ones_like(deltac), deltac)
      rc, gc, bc = torch.unbind((max_rgb.unsqueeze(-3) - image), dim=-3)
  
      h1 = bc - gc
      h2 = (rc - bc) + 2.0 * deltac
      h3 = (gc - rc) + 4.0 * deltac
  
      h = torch.stack((h1, h2, h3), dim=-3) / deltac.unsqueeze(-3)
      h = torch.gather(
          h, dim=-3, index=argmax_rgb.unsqueeze(-3)
      ).squeeze(-3)
      h = (h / 6.0) % 1.0
      h = 2.0 * math.pi * h  # we return 0/2pi output
  
      return torch.stack((h, s, v), dim=-3)
  
file_path: kornia/kornia/color/hsv.py
imports: import math
  import torch
  from torch import nn
label_desc: Use image node_id 1 for calling a global function with example usage: rgb_to_hsv(image, eps) and returns: torch