eval() and run() in tensorflow
<p>I'm referring to <strong>Deep MNIST for Experts tutorial</strong> given by the tensorflow. I have a problem in <a href="https://www.tensorflow.org/versions/r0.10/tutorials/mnist/pros/index.html#train-and-evaluate-the-model" rel="noreferrer">Train and Evaluate</a> part of that tutorial. There they have given a sample code as follows.</p>

<pre><code>cross_entropy = tf.reduce_mean(-tf.reduce_sum(y_ * tf.log(y_conv),reduction_indices=[1]))
train_step = tf.train.AdamOptimizer(1e-4).minimize(cross_entropy)
correct_prediction = tf.equal(tf.argmax(y_conv,1), tf.argmax(y_,1))
accuracy = tf.reduce_mean(tf.cast(correct_prediction, tf.float32))
sess.run(tf.initialize_all_variables())
for i in range(20000):
  batch = mnist.train.next_batch(50)
  if i%100 == 0:
    train_accuracy = accuracy.eval(feed_dict={x:batch[0], y_: batch[1], keep_prob: 1.0})
    print("step %d, training accuracy %g"%(i, train_accuracy))
  train_step.run(feed_dict={x: batch[0], y_: batch[1], keep_prob: 0.5})

print("test accuracy %g"%accuracy.eval(feed_dict={x: mnist.test.images,
                       y_: mnist.test.labels, keep_prob: 1.0}))
</code></pre>

<p>So in these code segment they have used <code>accuracy.eval()</code> at one time. And other time <code>train_step.run()</code>. As I know of both of them are tensor variables.</p>

<p>And in some cases, I have seen like</p>

<pre><code>sess.run(variable, feed_dict)
</code></pre>

<p>So my question is what are the differences between these 3 implementations. And how can I know what to use when..?</p>

<p>Thank You!!</p>