code: def decode_image(
      input: torch.Tensor, mode: ImageReadMode = ImageReadMode.UNCHANGED
  ) -> torch.Tensor:
      """
      Detects whether an image is a JPEG or PNG and performs the appropriate
      operation to decode the image into a 3 dimensional RGB or grayscale Tensor.
  
      Optionally converts the image to the desired format.
      The values of the output tensor are uint8 in [0, 255].
  
      Args:
          input (Tensor): a one dimensional uint8 tensor containing the raw bytes of the
              PNG or JPEG image.
          mode (ImageReadMode): the read mode used for optionally converting the image.
              Default: ``ImageReadMode.UNCHANGED``.
              See ``ImageReadMode`` class for more information on various
              available modes.
  
      Returns:
          output (Tensor[image_channels, image_height, image_width])
      """
      output = torch.ops.image.decode_image(input, mode.value)
      return output
  
file_path: ImageAI/imageai/retinanet/utils.py
imports: from torchvision.io import ImageReadMode
  import torch
  from PIL import Image, ImageColor, ImageDraw, ImageFont
  from typing import List, Optional, Union, Tuple, BinaryIO
  import numpy
  import math
  import warnings
  import pathlib
label_desc: Use image node_id 2 for calling a global function with example usage: decode_image(input, mode) and returns: output