code: def test_msc_vbs_sampler(
      num_repeats: int,
      trunc_ra_sampler: bool,
      min_res_h: int,
      max_res_h: int,
      min_res_w: int,
      max_res_w: int,
      max_scales: int,
      batch_size: int,
  ) -> None:
      """Test for multi-scale variably-batch size sampler with and without repeated augmentation."""
      opts = get_config(
          config_file="tests/data/samplers/test_variable_batch_sampler_config.yaml"
      )
  
      set_common_defaults(opts, batch_size)
  
      setattr(opts, "sampler.vbs.max_n_scales", max_scales)
      setattr(opts, "sampler.vbs.min_crop_size_width", min_res_w)
      setattr(opts, "sampler.vbs.max_crop_size_width", max_res_w)
      setattr(opts, "sampler.vbs.min_crop_size_height", min_res_h)
      setattr(opts, "sampler.vbs.max_crop_size_height", max_res_h)
      setattr(opts, "sampler.num_repeats", num_repeats)
      setattr(
          opts, "sampler.truncated_repeat_aug_sampler", trunc_ra_sampler
      )
  
      sampler = build_sampler(
          opts, n_data_samples=N_DATA_SAMPLES, is_training=True
      )
  
      assert hasattr(sampler, "img_batch_tuples")
  
      scales_vbs = sampler.img_batch_tuples
  
      # check if number of sampled scales are <= max_scales + 1
      # + 1 here because if the base image size is not present in the sampled scales, then we add it
      assert len(scales_vbs) <= (max_scales + 1)
  
      for h, w, b_sz in scales_vbs:
          # Resolution needs to be within the specified intervals
          assert min_res_h <= h <= max_res_h
          assert min_res_w <= w <= max_res_w
  
          area_ratio = (h * w * 1.0) / (224 * 224)
  
          # For variable sampler, we expect larger batch sizes for smaller resolution as
          # compared to base batch size and vice-versa
          if area_ratio < 1.0:
              # When batch size=1 (or small), then MSc-VBS sampler behaves like MSc-FBS, i.e., any resolution slightly
              # smaller than base resolution have the same batch size of 1.
              assert b_sz >= batch_size, (
                  "For spatial resolution smaller than the base resolution, "
                  "we expect batch size >= base batch size"
              )
          elif area_ratio > 1.0:
              # When batch size=1 (or small), then MSc-VBS sampler behaves like MSc-FBS, i.e., any resolution higher
              # than base resolution have the same batch size of 1.
              assert b_sz <= batch_size, (
                  "For spatial resolution larger than base resolution, "
                  "we expect batch size to <= base batch size"
              )
          else:
              assert b_sz == batch_size, (
                  "For spatial resolution equal to the base resolution, "
                  "we expect batch size == base batch size"
              )
  
      # repeated sample test
      np.testing.assert_equal(
          len(sampler),
          N_DATA_SAMPLES * (1 if trunc_ra_sampler else num_repeats),
      )
  
file_path: ml-cvnets/tests/data/samplers/test_data_samplers.py
imports: import argparse
  from typing import Optional
  import numpy
  import pytest
  from data.sampler import build_sampler
  from tests.configs import get_config
label_desc: Use image node_id 4 for calling a global function with example usage: test_msc_vbs_sampler(num_repeats, trunc_ra_sampler, min_res_h, max_res_h, min_res_w, max_res_w, max_scales, batch_size) without return types