简体   繁体   English

Tensorflow 2.0.0-alpha0:tf.logging.set_verbosity

[英]Tensorflow 2.0.0-alpha0: tf.logging.set_verbosity

I've installed tensorflow 2.0.0-alpha0 . 我已经安装了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: 尝试使用tf.logging.set_verbosity(tf.logging.ERROR)命令设置日志记录详细程度时,出现以下错误:

module 'tensorflow' has no attribute 'logging'. 模块'tensorflow'没有属性'logging'。

Are there some changes with this point in the 2.0.0-alpha0 version? 2.0.0-alpha0版本中,这一点是否有一些变化?

In TensorFlow 2.0 you can still access tf.logging via tf.compat.v1 : TensorFlow 2.0 ,你仍然可以访问tf.logging通过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: 在这里 ,在Deprecated名称空间中 ,建议使用Python logging模块:

tf.logging - Python logging module can be used instead. tf.logging - 可以使用Python logging模块。

So you should use: 所以你应该使用:

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

before importing tensorflow . 在导入tensorflow之前。

As per official documentation 根据官方文件

Many APIs are either gone or moved in TF 2.0. 许多API在TF 2.0中消失或移动。 Some of the major changes include removing tf.app, tf.flags, and tf.logging 一些主要的变化包括删除tf.app,tf.flags和tf.logging

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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