Matching Tracks in TensorFlow

According to Sutton's book - Strengthening Learning: An Introduction, the network weights update equation is defined:

theta = theta + alpha * delta * e

where e tis an acceptability trace. It looks like a Gradient Descent update with an extra e t...
Can this matching trace be included tf.train.GradientDescentOptimizer

in TensorFlow?

+3


source to share


1 answer


Here's a simple use case tf.contrib.layers.scale_gradient

for simple gradient multiplication. In the forward pass, it is just the identifier op, and in the back pass, it multiplies the gradients by its second argument.

import tensorflow as tf

with tf.Graph().as_default():
  some_value = tf.constant([0.,0.,0.])
  scaled = tf.contrib.layers.scale_gradient(some_value, [0.1, 0.2, 0.3])
  (some_value_gradient,) = tf.gradients(tf.reduce_sum(scaled), some_value)
  with tf.Session():
    print(scaled.eval())
    print(some_value_gradient.eval())

      



Prints:

[ 0.  0.  0.]
[ 0.1         0.2         0.30000001]

      

+1


source







All Articles