简体   繁体   中英

What does that code snippet signify “tf.logging.set_verbosity(tf.logging.INFO)” in tensorflow code?

I have seen many usage of that line of code in many tensorflow projects. What does the line do in tensorflow?

It is easier to try this yourself. I use Pycharm IDE and it captures the output.

import tensorflow as tf

tf.logging.set_verbosity(tf.logging.DEBUG)
#tf.logging.set_verbosity(tf.logging.INFO) 
# Other settings

tf.logging.debug('Debug')
tf.logging.info('info')
tf.logging.warn('warn')
tf.logging.error('error')
tf.logging.fatal('fatal')

The logging level documentation page basically tells you: If you set it to the level as displayed ( INFO ), then TensorFlow will tell you all messages that have the label INFO (or more critical).

Say you would only be interested in WARN or ERROR , then you could similarly set tf.logging.set_verbosity(tf.logging.WARN)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM