code: def get_sliced_torch_case(case_name):
      # [(extents of the original shape), (slice of the corresponding extent)]
      # the original extents and slice shapes are purposely all prime numbers
      # to test handling of unaligned tensors
      prime_images = [
          ((107, 181, 3), (slice(1, 102), slice(179), slice(None))),
          ((1097, 227, 5), (slice(None), slice(None), slice(1, 4))),
          ((107, 167, 1), (slice(1, 14), slice(None), slice(None))),
          ((107, 23, 3), (slice(103), slice(None), slice(None))),
          ((173, 23, 5), (slice(None), slice(None), slice(1, 1))),
          ((401, 167, 5), (slice(4, 167), slice(None), slice(0, 3))),
          ((181, 401, 5), (slice(2, None), slice(397), slice(None))),
          ((181, 107, 1), (slice(179), slice(103), slice(1))),
          (
              (373, 181, 5),
              (slice(None), slice(None), slice(None, None, 2)),
          ),
          ((199, 401, 3), (slice(None), slice(None), slice(None))),
          (
              (167, 1097, 1),
              (slice(8, None, 7), slice(24, None, 23), slice(None)),
          ),
          ((181, 61, 1), (slice(179), slice(58, None), slice(None))),
          ((401, 61, 1), (slice(397), slice(None), slice(None))),
          ((373, 173, 1), (slice(None), slice(167), slice(None))),
          ((173, 199, 3), (slice(None), slice(None), slice(2, 3))),
          (
              (181, 1097, 1),
              (slice(2, None, None), slice(1093), slice(None)),
          ),
      ]
  
      prime_grey_images = [
          ((199, 23), (slice(None, 173, None), slice(None, 19, None))),
          ((373, 373), (slice(None, 331, None), slice(42, None, None))),
          (
              (1097, 181),
              (slice(114, None, None), slice(None, 157, None)),
          ),
          ((61, 227), (slice(None, 53, None), slice(28, None, None))),
          ((1097, 61), (slice(114, None, None), slice(None, 53, None))),
          (
              (181, 199),
              (slice(None, 157, None), slice(None, 173, None)),
          ),
          (
              (1097, 1097),
              (slice(114, None, None), slice(None, 983, None)),
          ),
          ((373, 227), (slice(42, None, None), slice(None, 199, None))),
          (
              (227, 173),
              (slice(None, 199, None), slice(None, 151, None)),
          ),
          ((227, 173), (slice(None, 199, None), slice(22, None, None))),
          ((401, 173), (slice(42, None, None), slice(None, 151, None))),
          ((107, 23), (slice(18, None, None), slice(None, 19, None))),
          ((23, 199), (slice(4, None, None), slice(26, None, None))),
          ((199, 23), (slice(26, None, None), slice(4, None, None))),
          ((227, 23), (slice(None, 199, None), slice(None, 19, None))),
          ((23, 23), (slice(4, None, None), slice(4, None, None))),
          ((167, 181), (slice(18, None, None), slice(24, None, None))),
          ((167, 181), (slice(18, None, None), slice(24, None, None))),
          (
              (181, 227),
              (slice(None, 157, None), slice(None, 199, None)),
          ),
          (
              (401, 199),
              (slice(None, 359, None), slice(None, 173, None)),
          ),
          ((107, 181), (slice(None, 89, None), slice(None, 157, None))),
          ((173, 61), (slice(None, 151, None), slice(8, None, None))),
          ((227, 167), (slice(None, 199, None), slice(18, None, None))),
          ((173, 401), (slice(22, None, None), slice(None, 359, None))),
          ((23, 227), (slice(4, None, None), slice(28, None, None))),
          ((227, 23), (slice(28, None, None), slice(4, None, None))),
          ((373, 373), (slice(42, None, None), slice(None, 331, None))),
          ((61, 107), (slice(None, 53, None), slice(18, None, None))),
          ((181, 61), (slice(24, None, None), slice(None, 53, None))),
          ((107, 181), (slice(None, 89, None), slice(24, None, None))),
          ((401, 23), (slice(42, None, None), slice(4, None, None))),
          ((373, 401), (slice(None, 331, None), slice(42, None, None))),
      ]
  
      vid = [
          ((17,) + shape, (slice(None),) + sl)
          for shape, sl in prime_images
      ]
  
      ndim_11 = [
          (
              tuple(3 if i == j else 1 for j in range(11)) + shape,
              ((slice(None),) * 11) + sl,
          )
          for i, (shape, sl) in enumerate(prime_images)
      ]
  
      cases = {
          "slice_images": prime_images,
          "slice_grey_images": prime_grey_images,
          "slice_vid": vid,
          "slice_ndim_11": ndim_11,
      }
      shape_slices = cases[case_name]
      shapes, slices = tuple(zip(*shape_slices))
      assert len(shapes) == len(slices) == len(shape_slices)
      return shapes, slices
  
imports: import numpy
  import nvidia.dali.ops
  import nvidia.dali.types
  import os
  import random
  from functools import partial
  from nvidia.dali.pipeline import Pipeline
  from nvidia.dali import fn, pipeline_def
  from nvidia.dali.python_function_plugin import current_dali_stream
label_desc: Use image node_id 34 for calling a global function with example usage: get_sliced_torch_case(case_name) and returns: shapes,  slices