简体   繁体   中英

Tensorflow 2.0.0-alpha0: tf.logging.set_verbosity

I've installed tensorflow 2.0.0-alpha0 . When trying to set logging verbosity with the tf.logging.set_verbosity(tf.logging.ERROR) command, I got the following error:

module 'tensorflow' has no attribute 'logging'.

Are there some changes with this point in the 2.0.0-alpha0 version?

In TensorFlow 2.0 you can still access tf.logging via tf.compat.v1 :

tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR)

EDIT

Here , in the Deprecated namespaces , it is suggested to use Python logging module:

tf.logging - Python logging module can be used instead.

So you should use:

import logging
logging.getLogger("tensorflow").setLevel(logging.ERROR)

before importing tensorflow .

As per official documentation

Many APIs are either gone or moved in TF 2.0. Some of the major changes include removing tf.app, tf.flags, and tf.logging

https://www.tensorflow.org/alpha/guide/effective_tf2

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