<p>RMSprop does not subtract the gradient from the parameters but use more complicated formula involving a combination of:  </p>

<ul>
<li>a momentum, if the corresponding parameter is not 0</li>
<li>a gradient step, rescaled non uniformly (on each coordinate) by the square root of the squared average of the gradient.  </li>
</ul>

<p>For more information you can refer to <a href="http://www.cs.toronto.edu/~tijmen/csc321/slides/lecture_slides_lec6.pdf" rel="nofollow">these slides</a> or <a href="http://arxiv.org/pdf/1502.04390v1.pdf" rel="nofollow">this recent paper</a>.</p>

<p>The delta is first computed in memory by tensorflow in the slot variable 'momentum' and then the variable is updated (see <a href="https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/kernels/training_ops.cc#L134" rel="nofollow">the C++ operator</a>).<br>
Thus, you should be able to access it and construct a delta node with <code>delta_w1 = self.rmsprop.get_slot(self.w1, 'momentum')</code>. (I have not tried it yet.)</p>
Tensorflow: opt.compute_gradients() returns values different from the weight difference of opt.apply_gradients()
<p><strong>Question:</strong> What is the most efficient way to get the delta of my weights in the most efficient way in a TensorFlow network?</p>

<p><strong>Background</strong>: I've got the operators hooked up as follows (thanks to this <a href="https://stackoverflow.com/questions/34687761/efficiently-grab-gradients-from-tensorflow">SO question</a>):</p>

<pre>
self.cost = `the rest of the network`
self.rmsprop = tf.train.RMSPropOptimizer(lr,rms_decay,0.0,rms_eps)
self.comp_grads = self.rmsprop.compute_gradients(self.cost)
self.grad_placeholder = [(tf.placeholder("float", shape=grad[1].get_shape(), name="grad_placeholder"), grad[1]) for grad in self.comp_grads]
self.apply_grads = self.rmsprop.apply_gradients(self.grad_placeholder)
</pre>

<p>Now, to feed in information, I run the following:</p>

<pre>
feed_dict = `training variables`
grad_vals = self.sess.run([grad[0] for grad in self.comp_grads], feed_dict=feed_dict)

feed_dict2 = `feed_dict plus gradient values added to self.grad_placeholder`
self.sess.run(self.apply_grads, feed_dict=feed_dict2)
</pre>

<p>The command of <code>run(self.apply_grads)</code> will update the network weights, but when I compute the differences in the starting and ending weights (<code>run(self.w1)</code>), those numbers are different than what is stored in <code>grad_vals[0]</code>.  I figure this is because the RMSPropOptimizer does more to the raw gradients, but I'm not sure what, or where to find out what it does.</p>

<p>So back to the question:  How do I get the delta on my weights in the most efficient way?  Am I stuck running <code>self.w1.eval(sess)</code> multiple times to get the weights and calc the difference?  Is there something that I'm missing with the <code>tf.RMSPropOptimizer</code> function.</p>

<p>Thanks!</p>