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: Pad images according to pad_size_divisor.
code: def get_padded_tensor(self, tensor: Tensor, pad_value: int) -> Tensor:
      """Pad images according to pad_size_divisor."""
      assert tensor.ndim == 4
      target_height, target_width = tensor.shape[-2], tensor.shape[-1]
      divisor = self.pad_size_divisor
      padded_height = (target_height + divisor - 1) // divisor * divisor
      padded_width = (target_width + divisor - 1) // divisor * divisor
      padded_tensor = (
          torch.ones(
              [
                  tensor.shape[0],
                  tensor.shape[1],
                  padded_height,
                  padded_width,
              ]
          )
          * pad_value
      )
      padded_tensor = padded_tensor.type_as(tensor)
      padded_tensor[:, :, :target_height, :target_width] = tensor
      return padded_tensor
  
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 4 for calling the BatchResize obj's underlying member method code with example usage: obj.get_padded_tensor(tensor, pad_value) and returns: padded_tensor