code: def _test_epoch_idx(
      batch_size, epoch_size, cb, batch_info, batch_mode
  ):
      num_epochs = 3
      pipe = Pipeline(batch_size, 1, 0)
      with pipe:
          ext = fn.external_source(
              source=cb, batch_info=batch_info, batch=batch_mode
          )
          pipe.set_outputs(ext)
      pipe.build()
      for epoch_idx in range(num_epochs):
          for iteration in range(epoch_size):
              (batch,) = pipe.run()
              assert len(batch) == batch_size
              for sample_i, sample in enumerate(batch):
                  if batch_mode:
                      expected = np.array(
                          [iteration, epoch_idx if batch_info else -1]
                      )
                  else:
                      expected = np.array(
                          [
                              iteration * batch_size + sample_i,
                              sample_i,
                              iteration,
                              epoch_idx,
                          ]
                      )
                  np.testing.assert_array_equal(sample, expected)
          try:
              pipe.run()
          except StopIteration:
              pipe.reset()
          else:
              assert False, "expected StopIteration"
  
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 10 for calling a global function with example usage: _test_epoch_idx(batch_size, epoch_size, cb, batch_info, batch_mode) without return types