MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / streaming_restore

Function streaming_restore

tensorflow/python/training/tracking/util.py:643–666  ·  view source on GitHub ↗

When graph building, runs restore ops as soon as they come in. Args: status: A _LoadStatus objects from an object-based saver's restore(). Streaming restore from name-based checkpoints is not currently supported. session: A session to run new restore ops in.

(status, session=None)

Source from the content-addressed store, hash-verified

641
642
643def streaming_restore(status, session=None):
644 """When graph building, runs restore ops as soon as they come in.
645
646 Args:
647 status: A _LoadStatus objects from an object-based saver's restore().
648 Streaming restore from name-based checkpoints is not currently supported.
649 session: A session to run new restore ops in.
650 """
651 if context.executing_eagerly():
652 # Streaming restore is the default/only behavior when executing eagerly.
653 return
654 if session is None:
655 session = get_session()
656 if isinstance(status, NameBasedSaverStatus):
657 raise NotImplementedError(
658 "Streaming restore not supported from name-based checkpoints when "
659 "graph building. File a feature request if this limitation bothers "
660 "you. As a workaround, consider either using tf.train.Checkpoint to "
661 "load name-based checkpoints or enabling eager execution.")
662 status.run_restore_ops(session=session)
663 # pylint: disable=protected-access
664 status._checkpoint.new_restore_ops_callback = (
665 lambda ops: session.run(ops, feed_dict=status._feed_dict))
666 # pylint: enable=protected-access
667
668
669class CheckpointLoadStatus(_LoadStatus):

Callers

nothing calls this directly

Calls 4

executing_eagerlyMethod · 0.80
get_sessionFunction · 0.70
run_restore_opsMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected