code: def save_images(
      images: torch.Tensor,
      dest_path: str,
      prefix: str = "",
      img_format: str = "jpeg",
  ):
      """
      ### Save a images
  
      :param images: is the tensor with images of shape `[batch_size, channels, height, width]`
      :param dest_path: is the folder to save images in
      :param prefix: is the prefix to add to file names
      :param img_format: is the image format
      """
  
      # Create the destination folder
      os.makedirs(dest_path, exist_ok=True)
  
      # Map images to `[0, 1]` space and clip
      images = torch.clamp((images + 1.0) / 2.0, min=0.0, max=1.0)
      # Transpose to `[batch_size, height, width, channels]` and convert to numpy
      images = images.cpu().permute(0, 2, 3, 1).numpy()
  
      # Save images
      for i, img in enumerate(images):
          img = Image.fromarray((255.0 * img).astype(np.uint8))
          img.save(
              os.path.join(dest_path, f"{prefix}{i:05}.{img_format}"),
              format=img_format,
          )
  
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 4 for calling a global function with example usage: save_images(images, dest_path, prefix, img_format) without return types