code: def convert_to_rgb(images: np.ndarray) -> np.ndarray:
      """
      Converts grayscale images to RGB. It changes NxHxWx1 to a NxHxWx3 array, where N is the number of figures,
      H is the high and W the width.
  
      :param images: Grayscale images of shape (NxHxWx1).
      :return: Images in RGB format of shape (NxHxWx3).
      """
      dims = np.shape(images)
      if not ((len(dims) == 4 and dims[-1] == 1) or len(dims) == 3):
          raise ValueError(
              "Unexpected shape for grayscale images:" + str(dims)
          )
  
      if dims[-1] == 1:
          # Squeeze channel axis if it exists
          rgb_images = np.squeeze(images, axis=-1)
      else:
          rgb_images = images
      rgb_images = np.stack((rgb_images,) * 3, axis=-1)
  
      return rgb_images
  
file_path: adversarial-robustness-toolbox/art/visualization.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import logging
  import os.path
  from typing import List, Optional, TYPE_CHECKING
  import numpy
  from art import config
label_desc: Use image node_id 2 for calling a global function with example usage: convert_to_rgb(images) and returns: rgb_images