As I have discussed in my previous posts, Tensorflow's computation graphs will not evaluate the expression unless one explicitly asks it to do so. One may find this quite annoying during debugging, so Tensorflow provides what is called Interactive Session, which let's you evaluate the expressions as you go, with minimal code.
This is really simple; just call
sess = tf.InteractiveSession()
in the beginning, and this will act like the block
with tf.Session() as sess:
See the code below.