code: def _pack_images(images, rows, cols):
    
    shape = onp.shape(images)
    width, height, depth = shape[-3:]
    images = onp.reshape(images, (-1, width, height, depth))
    batch = onp.shape(images)[0]
    rows = onp.minimum(rows, batch)
    cols = onp.minimum(batch // rows, cols)
    images = images[:rows * cols]
    images = onp.reshape(images, (rows, cols, width, height, depth))
    images = onp.transpose(images, [0, 2, 1, 3, 4])
    images = onp.reshape(images, [rows * width, cols * height, depth])
    return images
docs: 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.