code: def _test_external_source_iter(use_fn_api, device):
      iter_num = 5
      batch_size = 9
      pipe = Pipeline(batch_size, 3, 0)
  
      # this should produce a single Tensor / TensorList per batch,
      # not wrapped in additional list
      source = TestIterator(iter_num, batch_size, 4, device == "gpu")
  
      if use_fn_api:
          input = fn.external_source(source, device=device)
      else:
          ext_source = ops.ExternalSource(source, device=device)
          input = ext_source()
      pipe.set_outputs(input)
      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 13 for calling a global function with example usage: _test_external_source_iter(use_fn_api, device) without return types