code: def get_permute_extents_case(case_name):
      rng = random.Random(44)
  
      def permuted(it):
          copy = list(it)
          rng.shuffle(copy)
          return tuple(copy)
  
      def permuted_extents(ndim):
          extents = list(range(ndim))
          rng.shuffle(extents)
          return tuple(extents)
  
      # the original extents are purposely all prime numbers
      # to test handling of unaligned tensors
      prime_images = [
          (199, 181, 3),
          (1097, 61, 5),
          (373, 373, 1),
          (107, 23, 3),
          (173, 23, 5),
          (401, 167, 5),
          (181, 401, 5),
          (181, 107, 1),
          (373, 181, 5),
          (199, 401, 3),
          (1097, 1097, 1),
          (181, 61, 1),
          (401, 61, 1),
          (373, 173, 1),
          (227, 199, 3),
          (181, 1097, 1),
      ]
  
      if case_name == "transpose_channels_image":
          prime_images_transposed_channel = list(
              zip(prime_images, [(2, 0, 1)] * len(prime_images))
          )
          assert len(prime_images_transposed_channel) == len(
              prime_images
          )
          return prime_images_transposed_channel
  
      if case_name == "transpose_hw_image":
          prime_images_transposed_hw = list(
              zip(prime_images, [(1, 0, 2)] * len(prime_images))
          )
          assert len(prime_images_transposed_hw) == len(prime_images)
          return prime_images_transposed_hw
  
      if case_name == "image_random_permutation":
          prime_images_rnd_permuted = list(
              zip(
                  prime_images,
                  [
                      permuted_extents(3)
                      for _ in range(len(prime_images))
                  ],
              )
          )
          assert len(prime_images_rnd_permuted) == len(prime_images)
          return prime_images_rnd_permuted
  
      if case_name == "transpose_channels_video":
          prime_vid_like = [
              (13, 199, 181, 3),
              (3, 1097, 61, 5),
              (17, 373, 373, 1),
              (5, 107, 23, 3),
              (11, 173, 23, 5),
              (11, 401, 167, 5),
              (7, 181, 401, 5),
              (5, 181, 107, 1),
              (3, 373, 181, 5),
              (23, 199, 401, 3),
              (3, 1097, 1097, 1),
              (31, 181, 61, 1),
              (17, 401, 61, 1),
              (5, 373, 173, 1),
              (3, 227, 199, 3),
              (7, 181, 1097, 1),
          ]
  
          prime_vid_like_transposed_channel = list(
              zip(prime_vid_like, [(3, 0, 1, 2)] * len(prime_vid_like))
          )
          assert len(prime_vid_like_transposed_channel) == len(
              prime_vid_like
          )
          return prime_vid_like_transposed_channel
  
      if case_name == "ndim_6_permute_outermost_3":
          # optimization to early stop translation of flat output index to flat input index
          # should kick in, test if that's fine
          ndim_6_transpose_outermost = [
              (
                  permuted([3, 5, 7, 11, 13, 17]),
                  permuted_extents(3) + (3, 4, 5),
              )
              for _ in range(5)
          ]
          assert len(ndim_6_transpose_outermost) == 5
          return ndim_6_transpose_outermost
  
      if case_name == "ndim_6_permute_all":
          ndim_6_rnd_permuted = [
              (permuted([3, 5, 7, 11, 13, 17]), permuted_extents(6))
              for _ in range(32)
          ]
          assert len(ndim_6_rnd_permuted) == 32
          return ndim_6_rnd_permuted
  
      if case_name == "ndim_15_permute_all":
          # max ndim supported
          ndim_15_rnd_permuted = [
              (
                  permuted(
                      [3, 5, 7, 11, 13, 17, 1, 1, 1, 1, 1, 1, 1, 1, 1]
                  ),
                  permuted_extents(15),
              )
              for _ in range(32)
          ]
          assert len(ndim_15_rnd_permuted) == 32
          return ndim_15_rnd_permuted
  
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 37 for calling a global function with example usage: get_permute_extents_case(case_name) and returns: tuple, tuple, prime_images_transposed_channel, prime_images_transposed_hw, prime_images_rnd_permuted, prime_vid_like_transposed_channel, ndim_6_transpose_outermost, ndim_6_rnd_permuted, ndim_15_rnd_permuted