code: def pad(self, images):
      max_size = tuple(
          max(s) for s in zip(*[img.shape for img in images])
      )
      image_sizes = [im.shape[-2:] for im in images]
      images = [
          nn.functional.pad(
              im,
              [0, max_size[-1] - size[1], 0, max_size[-2] - size[0]],
              value=self.pad_value,
          )
          for size, im in zip(image_sizes, images)
      ]
  
      return torch.stack(images), torch.tensor(image_sizes)
  
file_path: H2O/h2o_flexgen/benchmark/third_party/transformers/examples/research_projects/lxmert/processing_image.py
imports: import sys
  from typing import Tuple
  import numpy
  import torch
  from PIL import Image
  from torch import nn
  from transformers.image_utils import PILImageResampling
  from utils import img_tensorize
label_desc: Use image node_id 2 for calling the Preprocess obj's underlying member method code with example usage: obj.pad(images) and returns: torch,  torch