code: def rgb_to_yuv(image: torch.Tensor) -> torch.Tensor:
      r"""Convert an RGB image to YUV.
  
      .. image:: _static/img/rgb_to_yuv.png
  
      The image data is assumed to be in the range of (0, 1).
  
      Args:
          image: RGB Image to be converted to YUV with shape :math:`(*, 3, H, W)`.
  
      Returns:
          YUV version of the image with shape :math:`(*, 3, H, W)`.
  
      Example:
          >>> input = torch.rand(2, 3, 4, 5)
          >>> output = rgb_to_yuv(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}"
          )
  
      r: torch.Tensor = image[..., 0, :, :]
      g: torch.Tensor = image[..., 1, :, :]
      b: torch.Tensor = image[..., 2, :, :]
  
      y: torch.Tensor = 0.299 * r + 0.587 * g + 0.114 * b
      u: torch.Tensor = -0.147 * r - 0.289 * g + 0.436 * b
      v: torch.Tensor = 0.615 * r - 0.515 * g - 0.100 * b
  
      out: torch.Tensor = torch.stack([y, u, v], -3)
  
      return out
  
imports: from typing import Tuple
  import torch
  from torch import nn
label_desc: Use image node_id 1 for calling a global function with example usage: rgb_to_yuv(image) and returns: out