模块 'tensorflow' 没有属性 'logging' [英] module 'tensorflow' has no attribute 'logging'
本文介绍了模块 'tensorflow' 没有属性 'logging'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在 v2.0 中运行 tensorflow 代码,但出现以下错误
I'm trying to run a tensorflow code in v2.0 and I'mg getting the following error
AttributeError: module 'tensorflow' has no attribute 'logging'
我不想简单地从代码中删除它.
I don't want to simply remove it from the code.
- 为什么此代码已被删除?
- 我为什么要这样做?
推荐答案
tf.logging 用于 Logging and Summary Operations
并且在 TF 2.0 中它已被移除以支持开源 absl-py,并使主 tf.* 命名空间具有将更频繁使用的函数.
tf.logging was for Logging and Summary Operations
and in TF 2.0 it has been removed in favor of the open-source absl-py, and to make the main tf.* namespace has functions that will be used more often.
在 TF.2 中较少使用的函数被移除或移动到子包中,如 tf.math
In TF.2 lesser used functions are gone or moved into sub-packages like tf.math
因此,您可以:
tf_upgrade_v2
将升级脚本并将tf.logging
更改为tf.compat.v1.logging
- 可以改用 Python 日志模块
- 导入 absl-py 库
tf_upgrade_v2
will upgrade script and changestf.logging
totf.compat.v1.logging
- Python logging module can be used instead
- Import absl-py library
这篇关于模块 'tensorflow' 没有属性 'logging'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文