code: def rgba_to_rgb(image: torch.Tensor) -> torch.Tensor:
      r"""Convert an image from RGBA to RGB.
  
      Args:
          image: RGBA Image to be converted to RGB of shape :math:`(*,4,H,W)`.
  
      Returns:
          RGB version of the image with shape :math:`(*,3,H,W)`.
  
      Example:
          >>> input = torch.rand(2, 4, 4, 5)
          >>> output = rgba_to_rgb(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] != 4:
          raise ValueError(
              f"Input size must have a shape of (*, 4, H, W).Got {image.shape}"
          )
  
      # unpack channels
      r, g, b, a = torch.chunk(image, image.shape[-3], dim=-3)
  
      # compute new channels
      a_one = torch.tensor(1.0) - a
      r_new: torch.Tensor = a_one * r + a * r
      g_new: torch.Tensor = a_one * g + a * g
      b_new: torch.Tensor = a_one * b + a * b
  
      return torch.cat([r_new, g_new, b_new], dim=-3)
  
imports: from typing import Union, cast
  import torch
  from torch import nn
label_desc: Use image node_id 5 for calling a global function with example usage: rgba_to_rgb(image) and returns: torch