class_docstr: Performs input / target transformation before feeding the data to a GeneralizedRCNN
  model.
  
  The transformations it perform 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","perform","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"]
docstr: 将一批图像打包成一个batch返回（注意batch中每个tensor的shape是相同的）
  Args:
      images: 输入的一批图片
      size_divisible: 将图像高和宽调整到该数的整数倍
  
  Returns:
      batched_imgs: 打包成一个batch后的tensor数据
docstr_tok: ["\u5c06\u4e00\u6279\u56fe\u50cf\u6253\u5305\u6210\u4e00\u4e2abatch\u8fd4\u56de\uff08\u6ce8\u610fbatch\u4e2d\u6bcf\u4e2atensor\u7684shape\u662f\u76f8\u540c\u7684\uff09","Args",":","images",":","\u8f93\u5165\u7684\u4e00\u6279\u56fe\u7247","size_divisible",":","\u5c06\u56fe\u50cf\u9ad8\u548c\u5bbd\u8c03\u6574\u5230\u8be5\u6570\u7684\u6574\u6570\u500d","Returns",":","batched_imgs",":","\u6253\u5305\u6210\u4e00\u4e2abatch\u540e\u7684tensor\u6570\u636e"]
code: def batch_images(self, images, size_divisible=32):
      # type: (List[Tensor], int) -> Tensor
      """
      将一批图像打包成一个batch返回（注意batch中每个tensor的shape是相同的）
      Args:
          images: 输入的一批图片
          size_divisible: 将图像高和宽调整到该数的整数倍
  
      Returns:
          batched_imgs: 打包成一个batch后的tensor数据
      """
  
      if torchvision._is_tracing():
          # batch_images() does not export well to ONNX
          # call _onnx_batch_images() instead
          return self._onnx_batch_images(images, size_divisible)
  
      # 分别计算一个batch中所有图片中的最大channel, height, width
      max_size = self.max_by_axis([list(img.shape) for img in images])
  
      stride = float(size_divisible)
      # max_size = list(max_size)
      # 将height向上调整到stride的整数倍
      max_size[1] = int(math.ceil(float(max_size[1]) / stride) * stride)
      # 将width向上调整到stride的整数倍
      max_size[2] = int(math.ceil(float(max_size[2]) / stride) * stride)
  
      # [batch, channel, height, width]
      batch_shape = [len(images)] + max_size
  
      # 创建shape为batch_shape且值全部为0的tensor
      batched_imgs = images[0].new_full(batch_shape, 0)
      for img, pad_img in zip(images, batched_imgs):
          # 将输入images中的每张图片复制到新的batched_imgs的每张图片中，对齐左上角，保证bboxes的坐标不变
          # 这样保证输入到网络中一个batch的每张图片的shape相同
          # copy_: Copies the elements from src into self tensor and returns self
          pad_img[: img.shape[0], : img.shape[1], : img.shape[2]].copy_(
              img
          )
  
      return batched_imgs
  
imports: import math
  from typing import List, Tuple, Dict, Optional
  import torch
  from torch import nn, Tensor
  import torchvision
  from .image_list import ImageList
label_desc: Use image node_id 7 for calling the GeneralizedRCNNTransform obj's underlying member method code with example usage: obj.batch_images(images, size_divisible) and returns: batched_imgs, self