code: def test_runtime_indexing():
      def data_gen():
          return [
              np.float32([[0, 1, 2], [3, 4, 5]]),
              np.float32([[0, 1], [2, 3], [4, 5]]),
          ]
  
      src = fn.external_source(data_gen)
      lo_idxs = [
          np.array(x, dtype=np.int64) for x in [1, -5, 0, 2, -2, 1]
      ]
      hi_idxs = [np.array(x, dtype=np.int16) for x in [5, -1, 1, 2, 4]]
      lo0 = fn.external_source(source=lo_idxs, batch=False, cycle=True)
      hi1 = fn.external_source(source=hi_idxs, batch=False, cycle=True)
      pipe = index_pipe(src, lambda x: x[lo0:, :hi1])
      pipe.build()
      j = 0
      k = 0
      for _ in range(4):
          inp, cpu, gpu = pipe.run()
          for i in range(len(inp)):
              x = inp.at(i)
              # fmt: off
              ref = x[lo_idxs[j]:, :hi_idxs[k]]
              # fmt: on
              j = (j + 1) % len(lo_idxs)
              k = (k + 1) % len(hi_idxs)
              assert np.array_equal(ref, cpu.at(i))
              assert np.array_equal(ref, gpu.as_cpu().at(i))
  
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 7 for calling a global function with example usage: test_runtime_indexing() and returns: list