code: def check_spawn_with_callback(
      callback_class,
      callback_ref_class=ExtCallback,
      num_outputs=None,
      layout=None,
      dtypes=[np.float32, np.int32, np.uint8],
      shapes=[(4, 5)],
      random_data=False,
      random_shape=False,
  ):
      epoch_size = 250
      for shape in shapes:
          for dtype in dtypes:
              callback = callback_class(
                  shape,
                  epoch_size,
                  dtype,
                  random_data=random_data,
                  random_shape=random_shape,
              )
              callback_ref = callback_ref_class(
                  shape,
                  epoch_size,
                  dtype,
                  random_data=random_data,
                  random_shape=random_shape,
              )
              for workers_num in [1, 4]:
                  for batch_size in [1, 16, 150]:
                      yield (
                          _check_spawn_with_callback,
                          callback,
                          callback_ref,
                          batch_size,
                          num_outputs,
                          layout,
                          workers_num,
                          epoch_size,
                          dtype,
                      )
  
imports: import numpy
  import nvidia.dali
  from nose.tools import with_setup
  from test_pool_utils import capture_processes, teardown_function, setup_function
  from test_utils import compare_pipelines, check_batch, RandomDataIterator, RandomlyShapedDataIterator
label_desc: Use image node_id 5 for calling a global function with example usage: check_spawn_with_callback(callback_class, callback_ref_class, num_outputs, layout, dtypes, shapes, random_data, random_shape) without return types