code: def create_decoder_slice_pipeline(data_path, device):
      jpegs, _ = fn.readers.file(
          file_root=data_path, shard_id=0, num_shards=1, name="Reader"
      )
  
      anchor = fn.random.uniform(range=[0.05, 0.15], shape=(2,))
      shape = fn.random.uniform(range=[0.5, 0.7], shape=(2,))
      images_sliced_1 = fn.decoders.image_slice(
          jpegs,
          anchor,
          shape,
          device=device,
          hw_decoder_load=0.7,
          output_type=types.RGB,
          axes=(0, 1),
      )
  
      images = fn.decoders.image(
          jpegs,
          device=device,
          hw_decoder_load=0.7,
          output_type=types.RGB,
      )
      images_sliced_2 = fn.slice(images, anchor, shape, axes=(0, 1))
  
      return images_sliced_1, images_sliced_2
  
imports: import glob
  import math
  import numpy
  import nvidia.dali.backend
  import nvidia.dali.fn
  import nvidia.dali.types
  import os
  import random
  from nvidia.dali import pipeline_def
  from nose2.tools import params
  from nose_utils import assert_raises
  from test_utils import check_output_pattern
  from test_utils import compare_pipelines
  from test_utils import get_dali_extra_path
  from test_utils import to_array
label_desc: Use image node_id 5 for calling a global function with example usage: create_decoder_slice_pipeline(data_path, device) and returns: images_sliced_1,  images_sliced_2