In [1]:
import tensorflow as tf


sess = tf.InteractiveSession()

tensor = tf.range(10)
print_op = tf.print(tensor)
with tf.control_dependencies([print_op]):
    out = tf.add(tensor, tensor)
    print(out.eval())

sess.close()


[ 0  2  4  6  8 10 12 14 16 18]