class_docstr: Performs input / target transformation before feeding the data to a GeneralizedRCNN
  model.
  
  The transformations it performs are:
      - input normalization (mean subtraction and std division)
      - input / target resizing to match min_size / max_size
  
  It returns a ImageList for the inputs, and a List[Dict[Tensor]] for the targets
class_docstr_tok: ["Performs","input","\/","target","transformation","before","feeding","the","data","to","a","GeneralizedRCNN","model",".","The","transformations","it","performs","are",":","-","input","normalization","(","mean","subtraction","and","std","division",")","-","input","\/","target","resizing","to","match","min_size","\/","max_size","It","returns","a","ImageList","for","the","inputs",",","and","a","List","[","Dict","[","Tensor","]","]","for","the","targets"]
code: def forward(
      self,
      images: List[Tensor],
      targets: Optional[List[Dict[str, Tensor]]] = None,
  ) -> Tuple[ImageList, Optional[List[Dict[str, Tensor]]]]:
      images = [img for img in images]
      if targets is not None:
          # make a copy of targets to avoid modifying it in-place
          # once torchscript supports dict comprehension
          # this can be simplified as follows
          # targets = [{k: v for k,v in t.items()} for t in targets]
          targets_copy: List[Dict[str, Tensor]] = []
          for t in targets:
              data: Dict[str, Tensor] = {}
              for k, v in t.items():
                  data[k] = v
              targets_copy.append(data)
          targets = targets_copy
      for i in range(len(images)):
          image = images[i]
          target_index = targets[i] if targets is not None else None
  
          if image.dim() != 3:
              raise ValueError(
                  f"images is expected to be a list of 3d tensors of shape [C, H, W], got {image.shape}"
              )
          image = self.normalize(image)
          image, target_index = self.resize(image, target_index)
          images[i] = image
          if targets is not None and target_index is not None:
              targets[i] = target_index
  
      image_sizes = [img.shape[-2:] for img in images]
      images = self.batch_images(
          images, size_divisible=self.size_divisible
      )
      image_sizes_list: List[Tuple[int, int]] = []
      for image_size in image_sizes:
          torch._assert(
              len(image_size) == 2,
              f"Input tensors expected to have in the last two elements H and W, instead got {image_size}",
          )
          image_sizes_list.append((image_size[0], image_size[1]))
  
      image_list = ImageList(images, image_sizes_list)
      return image_list, targets
  
imports: import math
  from typing import Any, Dict, List, Optional, Tuple
  import torch
  import torchvision
  from torch import nn, Tensor
  from .image_list import ImageList
  from .roi_heads import paste_masks_in_image
label_desc: Use image node_id 2 for calling the GeneralizedRCNNTransform obj's underlying member method code with example usage: obj.forward(images, targets) and returns: image_list,  targets