Python – Tensorflow doesn’t output any log information in Spyder?

Tensorflow doesn’t output any log information in Spyder?… here is a solution to the problem.

Tensorflow doesn’t output any log information in Spyder?

What is written on the jar head. This issue:

https://github.com/spyder-ide/spyder/issues/3777

It has been in business for many years. Someone must have made tensorflow output information to the Spyder console?

For the record, my Tensorflow is working fine. I ran a simple example here:

a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a')
b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b')
c = tf.matmul(a, b)
sess = tf. Session(config=tf. ConfigProto(log_device_placement=True))
print(sess.run(c))

It just gives me the answer, not the log information I want. I tried running the actual code doing the same thing (answer, no log info), but since it takes a long time, I really like the console output.

But I don’t know how to actually implement the code snippet there.

Solution

I didn’t have any problems printing log information using Spyder. You may need to enable logging in your application:

tf.logging.set_verbosity(tf.logging.INFO)

Many developers set the TF_CPP_MIN_LOG_LEVEL environment variable to 3 to prevent TensorFlow from prompting for features supported by the device. I’ll check it out.

If you run the code below, will it print anything?

tf.logging.info('Hi there!')

Related Problems and Solutions