code: def _test_indexing(
      data_gen,
      input_layout,
      output_layout,
      dali_index_func,
      ref_index_func=None,
  ):
      src = fn.external_source(data_gen, layout=input_layout)
      pipe = index_pipe(src, dali_index_func)
      pipe.build()
      inp, cpu, gpu = pipe.run()
      for i in range(len(inp)):
          x = inp.at(i)
          ref = (ref_index_func or dali_index_func)(x)
          assert np.array_equal(ref, cpu.at(i))
          assert np.array_equal(ref, gpu.as_cpu().at(i))
          assert cpu.layout() == output_layout
          assert gpu.layout() == output_layout
  
imports: from nvidia import dali
  from nvidia.dali import fn
  import numpy
  from nvidia.dali.pipeline import Pipeline
  from nose_utils import assert_raises
label_desc: Use image node_id 3 for calling a global function with example usage: _test_indexing(data_gen, input_layout, output_layout, dali_index_func, ref_index_func) without return types