code: def _test_external_source_callback_split(
      use_fn_api, batch, as_tensor, device
  ):
      iter_num = 5
      batch_size = 9
      pipe = Pipeline(batch_size, 3, 0)
  
      # this should produce a two-element list of Tensor(Lists), the first
      # being 2D, the second being 3D (+ batch dimension)
      source = TestIterator(iter_num, batch_size, [2, 3], as_tensor)
      iter_in = (
          iter(source)
          if batch
          else iter(SampleIterator(iter(source), True))
      )
  
      if use_fn_api:
          inputs = fn.external_source(
              lambda: next(iter_in), 2, device=device, batch=batch
          )
      else:
          ext_source = ops.ExternalSource(
              lambda: next(iter_in),
              num_outputs=2,
              device=device,
              batch=batch,
          )
          inputs = ext_source()
      pipe.set_outputs(*inputs)
      pipe.build()
  
      run_and_check(pipe, source)
  
imports: import functools
  import numpy
  import nvidia.dali.fn
  import nvidia.dali.ops
  from nvidia.dali import Pipeline
  from nose_utils import assert_raises
  from test_utils import check_output
label_desc: Use image node_id 11 for calling a global function with example usage: _test_external_source_callback_split(use_fn_api, batch, as_tensor, device) without return types