class_docstr: Batch random resize which synchronizes the random size across ranks.
  
  Args:
      random_size_range (tuple): The multi-scale random range during
          multi-scale training.
      interval (int): The iter interval of change
          image size. Defaults to 10.
      size_divisor (int): Image size divisible factor.
          Defaults to 32.
class_docstr_tok: ["Batch","random","resize","which","synchronizes","the","random","size","across","ranks",".","Args",":","random_size_range","(","tuple",")",":","The","multi-scale","random","range","during","multi-scale","training",".","interval","(","int",")",":","The","iter","interval","of","change","image","size",".","Defaults","to","10.","size_divisor","(","int",")",":","Image","size","divisible","factor",".","Defaults","to","32","."]
docstr: resize a batch of images and bboxes to shape ``self._input_size``
code: def forward(
      self, inputs: Tensor, data_samples: List[DetDataSample]
  ) -> Tuple[Tensor, List[DetDataSample]]:
      """resize a batch of images and bboxes to shape ``self._input_size``"""
      h, w = inputs.shape[-2:]
      if self._input_size is None:
          self._input_size = (h, w)
      scale_y = self._input_size[0] / h
      scale_x = self._input_size[1] / w
      if scale_x != 1 or scale_y != 1:
          inputs = F.interpolate(
              inputs,
              size=self._input_size,
              mode="bilinear",
              align_corners=False,
          )
          for data_sample in data_samples:
              img_shape = (
                  int(data_sample.img_shape[0] * scale_y),
                  int(data_sample.img_shape[1] * scale_x),
              )
              pad_shape = (
                  int(data_sample.pad_shape[0] * scale_y),
                  int(data_sample.pad_shape[1] * scale_x),
              )
              data_sample.set_metainfo(
                  {
                      "img_shape": img_shape,
                      "pad_shape": pad_shape,
                      "batch_input_shape": self._input_size,
                  }
              )
              data_sample.gt_instances.bboxes[..., 0::2] = (
                  data_sample.gt_instances.bboxes[..., 0::2] * scale_x
              )
              data_sample.gt_instances.bboxes[..., 1::2] = (
                  data_sample.gt_instances.bboxes[..., 1::2] * scale_y
              )
              if "ignored_instances" in data_sample:
                  data_sample.ignored_instances.bboxes[..., 0::2] = (
                      data_sample.ignored_instances.bboxes[..., 0::2]
                      * scale_x
                  )
                  data_sample.ignored_instances.bboxes[..., 1::2] = (
                      data_sample.ignored_instances.bboxes[..., 1::2]
                      * scale_y
                  )
      message_hub = MessageHub.get_current_instance()
      if (message_hub.get_info("iter") + 1) % self._interval == 0:
          self._input_size = self._get_random_size(
              aspect_ratio=float(w / h), device=inputs.device
          )
      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 BatchSyncRandomResize obj's underlying member method code with example usage: obj.forward(inputs, data_samples) and returns: inputs,  data_samples