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

查看:34
本文介绍了Tensorflow 2.0.0-alpha0:tf.logging.set_verbosity的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装了 tensorflow 2.0.0-alpha0.尝试使用 tf.logging.set_verbosity(tf.logging.ERROR) 命令设置日志详细程度时,出现以下错误:

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:

模块 'tensorflow' 没有属性 'logging'.

module 'tensorflow' has no attribute 'logging'.

2.0.0-alpha0 版本在这一点上有什么变化吗?

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

推荐答案

TensorFlow 2.0 中,您仍然可以通过 tf.compat.v1 访问 tf.logging:

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)

编辑

这里,在已弃用的命名空间,建议使用 Python logging 模块:

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

tf.logging - 可以使用 Python logging 模块代替.

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

所以你应该使用:

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

在导入tensorflow之前.

这篇关于Tensorflow 2.0.0-alpha0:tf.logging.set_verbosity的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆