code: def __call__(self, images, single_image=False):
      with torch.no_grad():
          if not isinstance(images, list):
              images = [images]
          if single_image:
              assert len(images) == 1
          for i in range(len(images)):
              if isinstance(images[i], torch.Tensor):
                  images.insert(
                      i, images.pop(i).to(self.device).float()
                  )
              elif not isinstance(images[i], torch.Tensor):
                  images.insert(
                      i,
                      torch.as_tensor(
                          img_tensorize(
                              images.pop(i),
                              input_format=self.input_format,
                          )
                      )
                      .to(self.device)
                      .float(),
                  )
          # resize smallest edge
          raw_sizes = torch.tensor([im.shape[:2] for im in images])
          images = self.aug(images)
          # transpose images and convert to torch tensors
          # images = [torch.as_tensor(i.astype("float32")).permute(2, 0, 1).to(self.device) for i in images]
          # now normalize before pad to avoid useless arithmetic
          images = [self.normalizer(x) for x in images]
          # now pad them to do the following operations
          images, sizes = self.pad(images)
          # Normalize
  
          if self.size_divisibility > 0:
              raise NotImplementedError()
          # pad
          scales_yx = torch.true_divide(raw_sizes, sizes)
          if single_image:
              return images[0], sizes[0], scales_yx[0]
          else:
              return images, sizes, scales_yx
  
file_path: 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 3 for calling the Preprocess obj's underlying member method code with example usage: obj.__call__(images, single_image) and returns: images,  sizes,  scales_yx, images,  sizes,  scales_yx