code: def check_slice_named_args(device, batch_size):
      test_data_shape = [5, 4, 3]
  
      def get_data():
          out = [
              np.random.randint(
                  0, 255, size=test_data_shape, dtype=np.uint8
              )
              for _ in range(batch_size)
          ]
          return out
  
      pipe = Pipeline(batch_size=batch_size, num_threads=4, device_id=0)
      with pipe:
          data = fn.external_source(source=get_data, layout="HWC")
          in_shape_list = [5, 4]
          start_list = [1, 2]
          shape_list = [3, 1]
          in_shape = np.array(in_shape_list)
          start = np.array(start_list)
          shape = np.array(shape_list)
          end_list = [start_list[i] + shape_list[i] for i in range(2)]
          end = start + shape
          rel_start_list = [
              start_list[i] / in_shape_list[i] for i in range(2)
          ]
          rel_start = start / in_shape
          rel_shape_list = [
              shape_list[i] / in_shape_list[i] for i in range(2)
          ]
          rel_shape = shape / in_shape
          rel_end_list = [
              end_list[i] / in_shape_list[i] for i in range(2)
          ]
          rel_end = end / in_shape
  
          outs = [
              fn.slice(data, start, shape, axes=(0, 1)),
              fn.slice(data, rel_start, rel_shape, axes=(0, 1)),
          ]
  
          for start_arg in [start, start_list]:
              for shape_arg in [shape, shape_list]:
                  outs += [
                      fn.slice(
                          data,
                          start=start_arg,
                          shape=shape_arg,
                          axes=(0, 1),
                      )
                  ]
              for end_arg in [end, end_list]:
                  outs += [
                      fn.slice(
                          data,
                          start=start_arg,
                          end=end_arg,
                          axes=(0, 1),
                      )
                  ]
          for rel_start_arg in [rel_start, rel_start_list]:
              for rel_shape_arg in [rel_shape, rel_shape_list]:
                  outs += [
                      fn.slice(
                          data,
                          rel_start=rel_start_arg,
                          rel_shape=rel_shape_arg,
                          axes=(0, 1),
                      )
                  ]
              for rel_end_arg in [rel_end, rel_end_list]:
                  outs += [
                      fn.slice(
                          data,
                          rel_start=rel_start_arg,
                          rel_end=rel_end_arg,
                          axes=(0, 1),
                      )
                  ]
              for shape_arg in [shape, shape_list]:
                  outs += [
                      fn.slice(
                          data,
                          rel_start=rel_start_arg,
                          shape=shape_arg,
                          axes=(0, 1),
                      )
                  ]
  
          pipe.set_outputs(*outs)
      pipe.build()
      for _ in range(3):
          outs = pipe.run()
          for out_idx in range(1, len(outs)):
              for sample in range(batch_size):
                  np.testing.assert_equal(
                      np.array(outs[0][sample]),
                      np.array(outs[out_idx][sample]),
                  )
  
imports: from nvidia.dali import Pipeline, pipeline_def, ops, fn, types
  import numpy
  import os
  from functools import partial
  from math import floor
  from test_utils import compare_pipelines, get_dali_extra_path, RandomDataIterator, generator_random_axes_for_3d_input, generator_random_data, as_array
  from nose_utils import assert_raises
  from nose2.tools import params
label_desc: Use image node_id 15 for calling a global function with example usage: check_slice_named_args(device, batch_size) and returns: out