code: def grid_display(array, num_rows=None, num_columns=None):
      """
      Display a list of images as a grid.
  
      Args:
          array (numpy.ndarray): 4D Tensor (batch_size, height, width, channels)
  
      Returns:
          numpy.ndarray: 3D Tensor as concatenation of input images on a grid
      """
      if num_rows is not None and num_columns is not None:
          total_grid_size = num_rows * num_columns
          if total_grid_size < len(array):
              warnings.warn(
                  Warning(
                      "Given values for num_rows and num_columns doesn't allow to display "
                      "all images. Values have been overrided to respect at least num_columns"
                  )
              )
              num_rows = math.ceil(len(array) / num_columns)
      elif num_rows is not None:
          num_columns = math.ceil(len(array) / num_rows)
      elif num_columns is not None:
          num_rows = math.ceil(len(array) / num_columns)
      else:
          num_rows = math.ceil(math.sqrt(len(array)))
          num_columns = math.ceil(math.sqrt(len(array)))
  
      number_of_missing_elements = num_columns * num_rows - len(array)
      # We fill the array with np.zeros elements to obtain a perfect square
      array = np.append(
          array,
          np.zeros(
              (number_of_missing_elements, *array[0].shape)
          ).astype(array.dtype),
          axis=0,
      )
  
      grid = np.concatenate(
          [
              np.concatenate(
                  array[
                      index * num_columns : (index + 1) * num_columns
                  ],
                  axis=1,
              )
              for index in range(num_rows)
          ],
          axis=0,
      )
  
      return grid
  
file_path: tf-explain/tf_explain/utils/display.py
imports: import math
  import warnings
  import numpy
  import cv2
label_desc: Use image node_id 1 for calling a global function with example usage: grid_display(array, num_rows, num_columns) and returns: grid