Defined in tensorflow/contrib/data/python/ops/

See the guide: Dataset Input Pipeline > Extra functions from

Returns a SaveableObject for saving/restore iterator state using Saver.


  • iterator: Iterator.

For example:

with tf.Graph().as_default():
  ds =
  iterator = ds.make_initializable_iterator()
  # Build the iterator SaveableObject.
  saveable_obj =
  # Add the SaveableObject to the SAVEABLE_OBJECTS collection so
  # it can be automatically saved using Saver.
  tf.add_to_collection(tf.GraphKeys.SAVEABLE_OBJECTS, saveable_obj)
  saver = tf.train.Saver()

  while continue_training:
    ... Perform training ...
    if should_save_checkpoint: