tf.contrib.eager.restore_variables_on_create

ContextManager that restores variables on creation.

When save_path is None (e.g. No checkpoint), does nothing. Otherwise, it preloads all values from checkpoint. When the corresponding variable is first created, it assigns the checkpoint value to the variable.

with restore_variables_on_create(
    tf.train.latest_checkpoint(checkpoint_dir)):
Args
save_path The checkpoint file prefix.
map_func A function that given the variable name as argument and returns a variable name in checkpoint for restore. If None, use the variable with the same name in checkpoint to restore. It's an error that the mapped variable name doesn't exist in checkpoint.

Yields:

Nothing.

Raises
NotFoundError If the variable is not found in checkpoint.
ValueError If not used in eager mode or map_func is not callable.

© 2020 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/eager/restore_variables_on_create