W3cubDocs

/TensorFlow Python

tf.contrib.eager.Saver

Class Saver

Defined in tensorflow/contrib/eager/python/saver.py.

A tf.train.Saver adapter for use when eager execution is enabled.

Methods

__init__

__init__(var_list)

A tf.train.Saver adapter for use when eager execution is enabled.

The API, and on-disk format, mimic tf.train.Saver except that no Session is needed.

Args:

  • var_list: The list of variables that will be saved and restored. Either a list of tfe.Variable objects, or a dictionary mapping names to tfe.Variable objects.

Raises:

  • RuntimeError: if invoked when eager execution has not been enabled.

restore

restore(file_prefix)

Restores previously saved variables.

Args:

  • file_prefix: Path prefix where parameters were previously saved. Typically obtained from a previous save() call, or from tf.train.latest_checkpoint.

save

save(
    file_prefix,
    global_step=None
)

Saves variables.

Args:

  • file_prefix: Path prefix of files created for the checkpoint.
  • global_step: If provided the global step number is appended to file_prefix to create the checkpoint filename. The optional argument can be a Tensor, a Variable, or an integer.

Returns:

A string: prefix of filenames created for the checkpoint. This may be an extension of file_prefix that is suitable to pass as an argument to a subsequent call to restore().

© 2018 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/api_docs/python/tf/contrib/eager/Saver