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)
| 641 | |
| 642 | |
| 643 | def 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 | |
| 669 | class CheckpointLoadStatus(_LoadStatus): |
nothing calls this directly
no test coverage detected