code: def ref_param(
      mag_range,
      mag_range_num_elements,
      bins_batch,
      mag_signs_batch=None,
      mag_to_param=None,
  ):
      if isinstance(mag_range, tuple):
          assert len(mag_range) == 2
          lo, hi = mag_range
          mag_range = np.linspace(lo, hi, mag_range_num_elements)
      magnitudes = [mag_range[mag_bin] for mag_bin in bins_batch]
      if mag_signs_batch is not None:
          assert len(mag_signs_batch) == len(magnitudes)
          magnitudes = [
              mag * ((-1) ** negate)
              for mag, negate in zip(magnitudes, mag_signs_batch)
          ]
      mag_to_param = (
          mag_to_param if mag_to_param is not None else np.array
      )
      return np.array([mag_to_param(mag) for mag in magnitudes])
  
imports: import numpy
  import nvidia.dali.tensors
  from nvidia.dali import pipeline_def, fn, types
  from nvidia.dali.auto_aug.core import augmentation, signed_bin
  from nvidia.dali.auto_aug.core._args import forbid_unused_kwargs
  from nose2.tools import params
  from test_utils import check_batch
  from nose_utils import assert_warns, assert_raises
label_desc: Use image node_id 2 for calling a global function with example usage: ref_param(mag_range, mag_range_num_elements, bins_batch, mag_signs_batch, mag_to_param) and returns: np