code: def rgb_to_gray(img):
      """rgb to gray conversion
  
      The input image is expected to be (..., channel, height, width).
      """
      assert img.dtype == torch.uint8
      img = img.to(torch.float32)
  
      r, g, b = torch.split(img, 1, dim=-3)
  
      gray = 0.299 * r + 0.587 * g + 0.114 * b
      return gray.to(torch.uint8)
  
imports: import torch
  from torchaudio._internal.module_utils import is_module_available
label_desc: Use image node_id 4 for calling a global function with example usage: rgb_to_gray(img) and returns: gray