【发布时间】:2019-07-31 14:09:14
【问题描述】:
我已经安装了 tensorflow 2.0.0-alpha0。尝试使用 tf.logging.set_verbosity(tf.logging.ERROR) 命令设置日志记录详细程度时,出现以下错误:
模块 'tensorflow' 没有属性 'logging'。
2.0.0-alpha0 版本的这一点是否有一些变化?
【问题讨论】:
标签: python tensorflow tensorflow2.0
我已经安装了 tensorflow 2.0.0-alpha0。尝试使用 tf.logging.set_verbosity(tf.logging.ERROR) 命令设置日志记录详细程度时,出现以下错误:
模块 'tensorflow' 没有属性 'logging'。
2.0.0-alpha0 版本的这一点是否有一些变化?
【问题讨论】:
标签: python tensorflow tensorflow2.0
在TensorFlow 2.0 中,您仍然可以通过tf.compat.v1 访问tf.logging:
tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR)
编辑
Here,在Deprecated namespaces中,建议使用Python logging模块:
tf.logging - 可以使用 Python
logging模块。
所以你应该使用:
import logging
logging.getLogger("tensorflow").setLevel(logging.ERROR)
在导入tensorflow之前。
【讨论】:
根据官方文档
许多 API 在 TF 2.0 中已消失或移动。一些主要的 更改包括删除 tf.app、tf.flags 和 tf.logging
【讨论】: