code: def load_img(path: str):
      """
      ### Load an image
  
      This loads an image from a file and returns a PyTorch tensor.
  
      :param path: is the path of the image
      """
      # Open Image
      image = Image.open(path).convert("RGB")
      # Get image size
      w, h = image.size
      # Resize to a multiple of 32
      w = w - w % 32
      h = h - h % 32
      image = image.resize((w, h), resample=PIL.Image.LANCZOS)
      # Convert to numpy and map to `[-1, 1]` for `[0, 255]`
      image = np.array(image).astype(np.float32) * (2.0 / 255.0) - 1
      # Transpose to shape `[batch_size, channels, height, width]`
      image = image[None].transpose(0, 3, 1, 2)
      # Convert to torch
      return torch.from_numpy(image)
  
file_path: annotated_deep_learning_paper_implementations/labml_nn/diffusion/stable_diffusion/util.py
imports: import os
  import random
  from pathlib import Path
  import PIL
  import numpy
  import torch
  from PIL import Image
  from labml import monit
  from labml.logger import inspect
  from labml_nn.diffusion.stable_diffusion.latent_diffusion import LatentDiffusion
  from labml_nn.diffusion.stable_diffusion.model.autoencoder import Encoder, Decoder, Autoencoder
  from labml_nn.diffusion.stable_diffusion.model.clip_embedder import CLIPTextEmbedder
  from labml_nn.diffusion.stable_diffusion.model.unet import UNetModel
label_desc: Use image node_id 3 for calling a global function with example usage: load_img(path) and returns: torch