'Build the graph to optimize the loss function.'

def optimize(self, loss):

    opts = self._options
    words_to_train = float((opts.words_per_epoch * opts.epochs_to_train))
    lr = (opts.learning_rate * tf.maximum(0.0001, (1.0 - (tf.cast(self._words, tf.float32) / words_to_train))))
    self._lr = lr
    optimizer = tf.train.GradientDescentOptimizer(lr)
    train = optimizer.minimize(loss, global_step=self.global_step, gate_gradients=optimizer.GATE_NONE)
    self._train = train
