code: def _pack_images(images, rows, cols):
      """Helper utility to make a tiled field of images from numpy arrays.
  
      Args:
        images: Image tensor in shape [N, W, H, C].
        rows: Number of images per row in tiled image.
        cols: Number of images per column in tiled image.
  
      Returns:
        A tiled image of shape [W * rows, H * cols, C].
        Truncates incomplete rows.
      """
      shape = np.shape(images)
      width, height, depth = shape[-3:]
      images = np.reshape(images, (-1, width, height, depth))
      batch = np.shape(images)[0]
      rows = np.minimum(rows, batch)
      cols = np.minimum(batch // rows, cols)
      images = images[: rows * cols]
      images = np.reshape(images, (rows, cols, width, height, depth))
      images = np.transpose(images, [0, 2, 1, 3, 4])
      images = np.reshape(images, [rows * width, cols * height, depth])
      return images
  
imports: import io
  import struct
  import time
  import warnings
  import wave
  import matplotlib
  import matplotlib.pyplot
  import numpy
  import tensorflow
  from tensorflow.core.util import event_pb2
  from tensorflow.python.summary.writer.event_file_writer import EventFileWriter
label_desc: Use image node_id 1 for calling a global function with example usage: _pack_images(images, rows, cols) and returns: images