When printing out the value of the node "c
" in the following example, to me, it seems that there's no difference between print sess.run(c)
and print c.eval()
. Can I assume that sess.run(c)
and c.eval()
are equivalent? Or are there any differences?
import tensorflow as tf
a = tf.Variable(2.0, name="a")
b = tf.Variable(3.0, name="b")
c = tf.add(a, b, name="add")
with tf.Session() as sess:
sess.run(tf.global_variables_initializer())
print sess.run(c)
with tf.Session() as sess:
sess.run(tf.global_variables_initializer())
print c.eval()