Why does tf.Print () not print in a tensor stream

The following code gives no error, but also does not print the tensor.

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 answer, I found that in the iPython console the code prints the tensor value. But I am using an iPython laptop. Is there a way to make it appear in a notebook?

+6
source share
1 answer

From the documentation:

This op prints a standard error. It is currently not compatible with jupyter laptop (print on laptop output, not laptop)

tf.print documentation

+5
source

All Articles