code: def images2d(
      images=None,
      second=10,
      saveable=True,
      name="images",
      dtype=None,
      fig_idx=3119362,
  ):
      """Display a group of RGB or Greyscale images.
  
      Parameters
      ----------
      images : numpy.array
          The images.
      second : int
          The display second(s) for the image(s), if saveable is False.
      saveable : boolean
          Save or plot the figure.
      name : str
          A name to save the image, if saveable is True.
      dtype : None or numpy data type
          The data type for displaying the images.
      fig_idx : int
          matplotlib figure index.
  
      Examples
      --------
      >>> X_train, y_train, X_test, y_test = tl.files.load_cifar10_dataset(shape=(-1, 32, 32, 3), plotable=False)
      >>> tl.visualize.images2d(X_train[0:100,:,:,:], second=10, saveable=False, name='cifar10', dtype=np.uint8, fig_idx=20212)
  
      """
      import matplotlib.pyplot as plt
  
      # tl.logging.info(images.shape)    # (50000, 32, 32, 3)
      # exit()
      if dtype:
          images = np.asarray(images, dtype=dtype)
      n_mask = images.shape[0]
      n_row = images.shape[1]
      n_col = images.shape[2]
      n_color = images.shape[3]
      row = int(np.sqrt(n_mask))
      col = int(np.ceil(n_mask / row))
      plt.ion()  # active mode
      fig = plt.figure(fig_idx)
      count = 1
      for _ir in range(1, row + 1):
          for _ic in range(1, col + 1):
              if count > n_mask:
                  break
              fig.add_subplot(col, row, count)
              # tl.logging.info(images[:,:,:,count-1].shape, n_row, n_col)   # (5, 1, 32) 5 5
              # plt.imshow(
              #         np.reshape(images[count-1,:,:,:], (n_row, n_col)),
              #         cmap='gray', interpolation="nearest")     # theano
              if n_color == 1:
                  plt.imshow(
                      np.reshape(
                          images[count - 1, :, :], (n_row, n_col)
                      ),
                      cmap="gray",
                      interpolation="nearest",
                  )
                  # plt.title(name)
              elif n_color == 3:
                  plt.imshow(
                      images[count - 1, :, :],
                      cmap="gray",
                      interpolation="nearest",
                  )
                  # plt.title(name)
              else:
                  raise Exception("Unknown n_color")
              plt.gca().xaxis.set_major_locator(
                  plt.NullLocator()
              )  # distable tick
              plt.gca().yaxis.set_major_locator(plt.NullLocator())
              count = count + 1
      if saveable:
          plt.savefig(name + ".pdf", format="pdf")
      else:
          plt.draw()
          plt.pause(second)
  
file_path: TensorLayer/tensorlayer/visualize.py
imports: import os
  import imageio
  import numpy
  import tensorlayer
  from tensorlayer.lazy_imports import LazyImport
  import colorsys, random
label_desc: Use image node_id 9 for calling a global function with example usage: images2d(images, second, saveable, name, dtype, fig_idx) without return types