AnnealingScalar

class tfsnippet.AnnealingScalar(loop, initial_value, ratio, epochs=None, steps=None, min_value=None, max_value=None)

Bases: tfsnippet.trainer.dynamic_values.DynamicValue

A DynamicValue scalar, which anneals every few epochs or steps.

For example, to anneal the learning rate every 100 epochs:

learning_rate = tf.placeholder(dtype=tf.float32, shape=())
...

with spt.TrainLoop(...) as loop:
    trainer = spt.Trainer(
        ...,
        feed_dict={learning_rate: spt.AnnealingScalar(
            loop, initial=0.001, ratio=0.5, epochs=100)}
    )

Methods Summary

get() Get the current value of this DynamicValue object.

Methods Documentation

get()

Get the current value of this DynamicValue object.