code: def test_shear_x(modality, dev):
      # adapted implementation from DeepLearningExamples:
      # https://github.com/NVIDIA/DeepLearningExamples/blob/master/PyTorch/
      # Classification/ConvNets/image_classification/autoaugment.py
      def shear_x_ref(img, magnitude):
          return img.transform(
              img.size,
              Image.AFFINE,
              (1, -magnitude, 0, 0, 1, 0),
              Image.BILINEAR,
              fillcolor=(128,) * 3,
          )
  
      data_source = get_images if modality == "image" else get_videos()
      shear_x = a.shear_x.augmentation(
          mag_range=(-0.3, 0.3), randomly_negate=False
      )
      magnitudes = shear_x._get_magnitudes(default_batch_size)
      compare_against_baseline(
          shear_x,
          pil_baseline(shear_x_ref),
          data_source,
          dev=dev,
          params=magnitudes,
          max_allowed_error=None,
          eps=1,
          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 7 for calling a global function with example usage: test_shear_x(modality, dev) and returns: img