VariableSaver

class tfsnippet.VariableSaver(variables, save_dir, max_versions=2, filename='variables.dat', latest_file='latest', save_meta=True, name=None, scope=None)

Bases: tfsnippet.utils.reuse.VarScopeObject

Version controlled saving and restoring TensorFlow variables.

Attributes Summary

name Get the name of this object.
variable_scope Get the variable scope of this object.

Methods Summary

get_latest_file() Get the latest available checkpoint file.
restore([ignore_non_exist]) Restore the checkpoint from file if it exists.
save([global_step]) Save the checkpoint to file.

Attributes Documentation

name

Get the name of this object.

variable_scope

Get the variable scope of this object.

Methods Documentation

get_latest_file()

Get the latest available checkpoint file.

restore(ignore_non_exist=False)

Restore the checkpoint from file if it exists.

Parameters:ignore_non_exist (bool) – Whether or not to ignore error if the checkpoint file does not exist? (default False)
Raises:IOError – If the checkpoint files do not exist, and ignore_non_exist is not True.
save(global_step=None)

Save the checkpoint to file.

Parameters:global_step (int or tf.Tensor) – The global step counter.