code: def check_stop_iteration_resume(pipe, batch_size, layout):
      pipe.build()
      capture_processes(pipe._py_pool)
      outputs_epoch_1, outputs_epoch_2 = [], []
      for output in [outputs_epoch_1, outputs_epoch_2]:
          try:
              while True:
                  (r,) = pipe.run()
                  r = [np.copy(r.at(i)) for i in range(len(r))]
                  output.append(r)
          except StopIteration:
              pipe.reset()
      assert len(outputs_epoch_1) == len(outputs_epoch_2), (
          "Epochs must have same number of iterations, "
          "but they have {} {} respectively".format(
              len(outputs_epoch_1), len(outputs_epoch_2)
          )
      )
      for out_1, out_2 in zip(outputs_epoch_1, outputs_epoch_2):
          check_batch(
              out_1,
              out_2,
              batch_size,
              0,
              None,
              expected_layout=layout,
              compare_layouts=True,
          )
  
imports: import numpy
  import nvidia.dali
  from nose.tools import with_setup
  from test_pool_utils import capture_processes, teardown_function, setup_function
  from test_utils import compare_pipelines, check_batch, RandomDataIterator, RandomlyShapedDataIterator
label_desc: Use image node_id 6 for calling a global function with example usage: check_stop_iteration_resume(pipe, batch_size, layout) without return types