Reset tensorflow Optimizer
<p>I am loading from a saved model and I would like to be able to reset a tensorflow optimizer such as an Adam Optimizer. Ideally something like:</p>

<pre><code>sess.run([tf.initialize_variables(Adamopt)])
</code></pre>

<p>or</p>

<pre><code>sess.run([Adamopt.reset])
</code></pre>

<p>I have tried looking for an answer but have yet to find any way to do it. Here's what I've found which don't address the issue:
<a href="https://github.com/tensorflow/tensorflow/issues/634" rel="nofollow">https://github.com/tensorflow/tensorflow/issues/634</a></p>

<p><a href="http://stackoverflow.com/questions/35164529/in-tensorflow-is-there-any-way-to-just-initialize-uninitialised-variables">In TensorFlow is there any way to just initialize uninitialised variables?</a></p>

<p><a href="http://stackoverflow.com/questions/33788989/tensorflow-using-adam-optimizer?noredirect=1&amp;lq=1">Tensorflow: Using Adam optimizer</a> </p>

<p>I basically just want a way to reset the "slot" variables in the Adam Optimizer.</p>

<p>Thanks</p>

<p>The simplest way I found was to give the optimizer its own variable scope and then run </p>

<pre><code>optimizer_scope = tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES,
                                 "scope/prefix/for/optimizer")
sess.run(tf.initialize_variables(optimizer_scope))
</code></pre>

<p>idea from <a href="http://stackoverflow.com/questions/35298326/freeze-some-variables-scopes-in-tensorflow-stop-gradient-vs-passing-variables">freeze weights</a></p>

python optimization tensorflow