The following code does not give any error but does not print the tensor too.
import tensorflow as tf
import numpy as np
# Some tensor we want to print the value of
x = tf.placeholder(tf.float32, shape=[2, 2, 2])
a = np.array([[[1.,1.], [1.,1.]], [[2.,2.], [2.,2.]]])
m = tf.Print(x,[x])
with tf.Session() as sess:
sess.run(tf.initialize_all_variables())
m_eval = m.eval(session=sess,feed_dict={x: a})
EDIT: after bgshi's reply, I found that in iPython console, the code does print the tensor value. But I'm using iPython notebook. Is there a way to make it displayed in notebook?