code: def test_posterize(modality, dev):
      data_source = get_images if modality == "image" else get_videos()
      # note, 0 is remapped to 1 as in tf implementation referred in the RA paper, thus (1, 8) range
      posterize = a.posterize.augmentation(
          param_device=dev, mag_range=(1, 8)
      )
      magnitudes = np.round(
          posterize._get_magnitudes(default_batch_size)
      ).astype(np.int32)
      compare_against_baseline(
          posterize,
          pil_baseline(ImageOps.posterize),
          data_source,
          max_allowed_error=1,
          dev=dev,
          params=magnitudes,
          modality=modality,
      )
  
imports: import itertools
  import os
  import numpy
  from PIL import Image, ImageEnhance, ImageOps
  from nose2.tools import params, cartesian_params
  import nvidia.dali.tensors
  from nvidia.dali import fn, pipeline_def
  from nvidia.dali.auto_aug import augmentations
  from nvidia.dali.auto_aug.core._utils import get_translations
  from test_utils import get_dali_extra_path, check_batch
label_desc: Use image node_id 18 for calling a global function with example usage: test_posterize(modality, dev) without return types