tf.contrib.checkpoint.UniqueNameTracker

Class UniqueNameTracker

Defined in tensorflow/contrib/checkpoint/python/containers.py.

Adds dependencies on checkpointable objects with name hints.

Useful for creating dependencies with locally unique names.

Example usage:

class SlotManager(tf.contrib.checkpoint.Checkpointable):

  def __init__(self):
    # Create a dependency named "slotdeps" on the container.
    self.slotdeps = tf.contrib.checkpoint.UniqueNameTracker()
    slotdeps = self.slotdeps
    slots = []
    slots.append(slotdeps.track(tf.Variable(3.), "x"))  # Named "x"
    slots.append(slotdeps.track(tf.Variable(4.), "y"))
    slots.append(slotdeps.track(tf.Variable(5.), "x"))  # Named "x_1"

__init__

__init__()

Initialize self. See help(type(self)) for accurate signature.

Properties

layers

losses

Aggregate losses from any Layer instances.

non_trainable_variables

non_trainable_weights

trainable_variables

trainable_weights

updates

Aggregate updates from any Layer instances.

variables

weights

Methods

tf.contrib.checkpoint.UniqueNameTracker.__eq__

__eq__(other)

Return self==value.

tf.contrib.checkpoint.UniqueNameTracker.track

track(
    checkpointable,
    base_name
)

Add a dependency on checkpointable.

Args:

  • checkpointable: An object to add a checkpoint dependency on.
  • base_name: A name hint, which is uniquified to determine the dependency name.

Returns:

checkpointable, for chaining.

Raises:

  • ValueError: If checkpointable is not a checkpointable object.