LostTech.TensorFlow : API Documentation

Type CheckpointManager

Namespace tensorflow.train

Parent PythonObjectContainer

Interfaces ICheckpointManager

Deletes old checkpoints.

Example usage: `CheckpointManager` preserves its own state across instantiations (see the `__init__` documentation for details). Only one should be active in a particular directory at a time.
Show Example
import tensorflow as tf
            checkpoint = tf.train.Checkpoint(optimizer=optimizer, model=model)
            manager = tf.contrib.checkpoint.CheckpointManager(
                checkpoint, directory="/tmp/model", max_to_keep=5)
            status = checkpoint.restore(manager.latest_checkpoint)
            while True:
              # train
              manager.save() 

Methods

Properties

Public instance methods

object save(Variable checkpoint_number)

Creates a new checkpoint and manages it.
Parameters
Variable checkpoint_number
An optional integer, or an integer-dtype `Variable` or `Tensor`, used to number the checkpoint. If `None` (default), checkpoints are numbered using `checkpoint.save_counter`. Even if `checkpoint_number` is provided, `save_counter` is still incremented. A user-provided `checkpoint_number` is not incremented even if it is a `Variable`.
Returns
object
The path to the new checkpoint. It is also recorded in the `checkpoints` and `latest_checkpoint` properties.

object save(int checkpoint_number)

Creates a new checkpoint and manages it.
Parameters
int checkpoint_number
An optional integer, or an integer-dtype `Variable` or `Tensor`, used to number the checkpoint. If `None` (default), checkpoints are numbered using `checkpoint.save_counter`. Even if `checkpoint_number` is provided, `save_counter` is still incremented. A user-provided `checkpoint_number` is not incremented even if it is a `Variable`.
Returns
object
The path to the new checkpoint. It is also recorded in the `checkpoints` and `latest_checkpoint` properties.

object save_dyn(object checkpoint_number)

Creates a new checkpoint and manages it.
Parameters
object checkpoint_number
An optional integer, or an integer-dtype `Variable` or `Tensor`, used to number the checkpoint. If `None` (default), checkpoints are numbered using `checkpoint.save_counter`. Even if `checkpoint_number` is provided, `save_counter` is still incremented. A user-provided `checkpoint_number` is not incremented even if it is a `Variable`.
Returns
object
The path to the new checkpoint. It is also recorded in the `checkpoints` and `latest_checkpoint` properties.

Public properties

IList<object> checkpoints get;

A list of managed checkpoints.

Note that checkpoints saved due to `keep_checkpoint_every_n_hours` will not show up in this list (to avoid ever-growing filename lists).

object checkpoints_dyn get;

A list of managed checkpoints.

Note that checkpoints saved due to `keep_checkpoint_every_n_hours` will not show up in this list (to avoid ever-growing filename lists).

object latest_checkpoint get;

The prefix of the most recent checkpoint in `directory`.

Equivalent to `tf.train.latest_checkpoint(directory)` where `directory` is the constructor argument to `CheckpointManager`.

Suitable for passing to tf.train.Checkpoint.restore to resume training.

object latest_checkpoint_dyn get;

The prefix of the most recent checkpoint in `directory`.

Equivalent to `tf.train.latest_checkpoint(directory)` where `directory` is the constructor argument to `CheckpointManager`.

Suitable for passing to tf.train.Checkpoint.restore to resume training.

object PythonObject get;