class_docstr: Batch resize during training. This implementation is modified from
  https://github.com/Purkialo/CrowdDet/blob/master/lib/data/CrowdHuman.py.
  
  It provides the data pre-processing as follows:
  - A batch of all images will pad to a uniform size and stack them into
    a torch.Tensor by `DetDataPreprocessor`.
  - `BatchFixShapeResize` resize all images to the target size.
  - Padding images to make sure the size of image can be divisible by
    ``pad_size_divisor``.
  
  Args:
      scale (tuple): Images scales for resizing.
      pad_size_divisor (int): Image size divisible factor.
          Defaults to 1.
      pad_value (Number): The padded pixel value. Defaults to 0.
class_docstr_tok: ["Batch","resize","during","training",".","This","implementation","is","modified","from","https",":","\/\/github.com\/Purkialo\/CrowdDet\/blob\/master\/lib\/data\/CrowdHuman.py",".","It","provides","the","data","pre-processing","as","follows",":","-","A","batch","of","all","images","will","pad","to","a","uniform","size","and","stack","them","into","a","torch.Tensor","by","`","DetDataPreprocessor","`",".","-","`","BatchFixShapeResize","`","resize","all","images","to","the","target","size",".","-","Padding","images","to","make","sure","the","size","of","image","can","be","divisible","by","``","pad_size_divisor","``",".","Args",":","scale","(","tuple",")",":","Images","scales","for","resizing",".","pad_size_divisor","(","int",")",":","Image","size","divisible","factor",".","Defaults","to","1.","pad_value","(","Number",")",":","The","padded","pixel","value",".","Defaults","to","0","."]
docstr: resize a batch of images and bboxes.
code: def forward(
      self, inputs: Tensor, data_samples: List[DetDataSample]
  ) -> Tuple[Tensor, List[DetDataSample]]:
      """resize a batch of images and bboxes."""
  
      batch_height, batch_width = inputs.shape[-2:]
      target_height, target_width, scale = self.get_target_size(
          batch_height, batch_width
      )
  
      inputs = F.interpolate(
          inputs,
          size=(target_height, target_width),
          mode="bilinear",
          align_corners=False,
      )
  
      inputs = self.get_padded_tensor(inputs, self.pad_value)
  
      if data_samples is not None:
          batch_input_shape = tuple(inputs.size()[-2:])
          for data_sample in data_samples:
              img_shape = [
                  int(scale * _) for _ in list(data_sample.img_shape)
              ]
              data_sample.set_metainfo(
                  {
                      "img_shape": tuple(img_shape),
                      "batch_input_shape": batch_input_shape,
                      "pad_shape": batch_input_shape,
                      "scale_factor": (scale, scale),
                  }
              )
  
              data_sample.gt_instances.bboxes *= scale
              data_sample.ignored_instances.bboxes *= scale
  
      return inputs, data_samples
  
imports: import random
  from numbers import Number
  from typing import List, Optional, Sequence, Tuple, Union
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  from mmengine.dist import barrier, broadcast, get_dist_info
  from mmengine.logging import MessageHub
  from mmengine.model import BaseDataPreprocessor, ImgDataPreprocessor
  from mmengine.structures import PixelData
  from mmengine.utils import is_seq_of
  from torch import Tensor
  from mmdet.models.utils import unfold_wo_center
  from mmdet.models.utils.misc import samplelist_boxtype2tensor
  from mmdet.registry import MODELS
  from mmdet.structures import DetDataSample
  from mmdet.structures.mask import BitmapMasks
  from mmdet.utils import ConfigType
label_desc: Use image node_id 2 for calling the BatchResize obj's underlying member method code with example usage: obj.forward(inputs, data_samples) and returns: inputs,  data_samples