code: def read_img_as_tensor(
      img_path: AbstractPath, dtype: torch.dtype = torch.float32
  ) -> torch.Tensor:
      """Read an image file as a PyTorch tensor
  
      Args:
      ----
          img_path: location of the image file
          dtype: the desired data type of the output tensor. If it is float-related, values will be divided by 255.
  
      Returns:
      -------
          decoded image as a tensor
      """
      if dtype not in (torch.uint8, torch.float16, torch.float32):
          raise ValueError("insupported value for dtype")
  
      pil_img = Image.open(img_path, mode="r").convert("RGB")
  
      return tensor_from_pil(pil_img, dtype)
  
file_path: doctr/doctr/io/image/pytorch.py
imports: from io import BytesIO
  from typing import Tuple
  import numpy
  import torch
  from PIL import Image
  from torchvision.transforms.functional import to_tensor
  from doctr.utils.common_types import AbstractPath
label_desc: Use image node_id 2 for calling a global function with example usage: read_img_as_tensor(img_path, dtype) and returns: tensor_from_pil