code: def testSaveRestoreWithRepeat(self):
      def _build_graph(start, stop, num_epochs):
          iterator = dataset_ops.make_initializable_iterator(
              dataset_ops.Dataset.range(start, stop).repeat(num_epochs)
          )
          init_op = iterator.initializer
          get_next = iterator.get_next()
          save_op = self._save_op(iterator._iterator_resource)
          restore_op = self._restore_op(iterator._iterator_resource)
          return init_op, get_next, save_op, restore_op
  
      start = 2
      stop = 10
      num_epochs = 5
      break_range = 5
      break_epoch = 3
      with ops.Graph().as_default() as g:
          init_op, get_next, save_op, restore_op = _build_graph(
              start, stop, num_epochs
          )
          with self.session(graph=g) as sess:
              sess.run(variables.global_variables_initializer())
              sess.run(init_op)
              # Note: There is no checkpoint saved currently so a NotFoundError is
              # raised.
              with self.assertRaises(errors.NotFoundError):
                  sess.run(init_op)
                  sess.run(restore_op)
              for _ in range(break_epoch - 1):
                  for i in range(start, stop):
                      self.assertEqual(i, sess.run(get_next))
              for i in range(start, break_range):
                  self.assertEqual(i, sess.run(get_next))
              sess.run(save_op)
  
      with ops.Graph().as_default() as g:
          init_op, get_next, _, restore_op = _build_graph(
              start, stop, num_epochs
          )
          with self.session(graph=g) as sess:
              sess.run(init_op)
              sess.run(restore_op)
              for i in range(break_range, stop):
                  self.assertEqual(i, sess.run(get_next))
              for _ in range(break_epoch, num_epochs):
                  for i in range(start, stop):
                      self.assertEqual(i, sess.run(get_next))
              with self.assertRaises(errors.OutOfRangeError):
                  sess.run(get_next)
  
imports: import os
  from absl.testing import parameterized
  from tensorflow.python.checkpoint import checkpoint
  from tensorflow.python.checkpoint import checkpoint_management
  from tensorflow.python.checkpoint import checkpoint_options
  from tensorflow.python.data.experimental.ops import grouping
  from tensorflow.python.data.experimental.ops import interleave_ops
  from tensorflow.python.data.experimental.ops import scan_ops
  from tensorflow.python.data.experimental.ops import take_while_ops
  from tensorflow.python.data.kernel_tests import test_base
  from tensorflow.python.data.ops import dataset_ops
  from tensorflow.python.data.ops import options
  from tensorflow.python.eager import test
  from tensorflow.python.framework import combinations
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import errors
  from tensorflow.python.framework import ops
  from tensorflow.python.ops import gen_dataset_ops
  from tensorflow.python.ops import io_ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import parsing_ops
  from tensorflow.python.ops import random_ops
  from tensorflow.python.ops import script_ops
  from tensorflow.python.ops import variables
  from tensorflow.python.platform import gfile
label_desc: Use image node_id 8 for calling the CheckpointTest obj's underlying member method code with example usage: obj.testSaveRestoreWithRepeat() and returns: init_op,  get_next,  save_op,  restore_op