code: def generator(batch_size, max_frames, channel_dim, type):
      type = test_utils.dali_type_to_np(type)
      assert max_frames is not None or channel_dim != 1
  
      def generate():
          batch = []
          for _ in range(batch_size):
              frames = (
                  None
                  if max_frames is None
                  else np.random.randint(1, max_frames + 1)
              )
              sz = np.random.randint(100, 2000 / (max_frames or 1))
              w, h = np.random.randint(sz, 2 * sz, [2])
              batch.append(
                  generate_data(frames, w, h, channel_dim, type)
              )
          return batch
  
      return generate
  
file_path: DALI/dali/test/python/operator_2/test_random_resized_crop.py
imports: import numpy
  import nvidia.dali
  import nvidia.dali.fn
  import test_utils
label_desc: Use image node_id 8 for calling a global function with example usage: generator(batch_size, max_frames, channel_dim, type) and returns: generate, batch