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: Randomly generate a shape in ``_random_size_range`` and broadcast to
  all ranks.
code: def _get_random_size(
      self, aspect_ratio: float, device: torch.device
  ) -> Tuple[int, int]:
      """Randomly generate a shape in ``_random_size_range`` and broadcast to
      all ranks."""
      tensor = torch.LongTensor(2).to(device)
      if self.rank == 0:
          size = random.randint(*self._random_size_range)
          size = (
              self._size_divisor * size,
              self._size_divisor * int(aspect_ratio * size),
          )
          tensor[0] = size[0]
          tensor[1] = size[1]
      barrier()
      broadcast(tensor, 0)
      input_size = (tensor[0].item(), tensor[1].item())
      return input_size
  
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 3 for calling the BatchSyncRandomResize obj's underlying member method code with example usage: obj._get_random_size(aspect_ratio, device) and returns: input_size