code: def numpy_to_pil(images):
      """
      Convert a numpy image or a batch of images to a PIL image.
      """
      if images.ndim == 3:
          images = images[None, ...]
      images = (images * 255).round().astype("uint8")
      pil_images = [Image.fromarray(image) for image in images]
  
      return pil_images
  
file_path: NeMo/nemo/collections/multimodal/parts/utils.py
imports: import os
  from typing import Any, Callable, Tuple
  import torch
  from omegaconf import DictConfig, open_dict
  from PIL import Image
  from pytorch_lightning import Trainer
  from pytorch_lightning.plugins.environments import TorchElasticEnvironment
  from nemo.collections.nlp.parts.nlp_overrides import NLPDDPStrategy, NLPSaveRestoreConnector
  from nemo.utils import logging
label_desc: Use image node_id 1 for calling a global function with example usage: numpy_to_pil(images) and returns: pil_images