code: def _test_callback(device, as_tensors, change_layout_to=None):
      src_pipe, batch_size = build_src_pipe(device)
      ref_pipe, batch_size = build_src_pipe(
          device, layout=change_layout_to
      )
  
      dst_pipe = Pipeline(batch_size, 1, 0)
  
      def get_from_src():
          tl = src_pipe.run()[0]
          return [tl[i] for i in range(len(tl))] if as_tensors else tl
  
      outs = fn.external_source(
          source=get_from_src, device=device, layout=change_layout_to
      )
      dst_pipe.set_outputs(outs)
      dst_pipe.build()
  
      for iter in range(3):
          ref = ref_pipe.run()
          out = dst_pipe.run()
          check_batch(out[0], ref[0], batch_size, 0, 0)
  
imports: import random
  import nvidia.dali.fn
  import nvidia.dali.ops
  import nvidia.dali.types
  import numpy
  from nvidia.dali import Pipeline, pipeline_def
  from test_utils import check_batch
  from nose_utils import raises, assert_warns, assert_raises
  from nvidia.dali.types import DALIDataType
  from numpy.random import default_rng
label_desc: Use image node_id 4 for calling a global function with example usage: _test_callback(device, as_tensors, change_layout_to) and returns: unknown