code: def build_src_pipe(device, layout=None):
      if layout is None:
          layout = "XY"
      batches = [
          [
              np.array([[1, 2, 3], [4, 5, 6]], dtype=np.float32),
              np.array(
                  [[10, 20], [30, 40], [50, 60]], dtype=np.float32
              ),
          ],
          [
              np.array([[9, 10], [11, 12]], dtype=np.float32),
              np.array([[100, 200, 300, 400, 500]], dtype=np.float32),
          ],
      ]
  
      src_pipe = Pipeline(len(batches), 1, 0)
      out_batches = fn.external_source(
          source=batches, device=device, cycle=True, layout=layout
      )
      src_pipe.set_outputs(out_batches)
      src_pipe.build()
      return src_pipe, len(batches)
  
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 1 for calling a global function with example usage: build_src_pipe(device, layout) and returns: src_pipe,  len