AttributeError: module 'tensorflow' has no attribute 'logging'
时间: 2023-10-19 21:08:22 浏览: 401
从 TensorFlow 2.0 开始,`logging` 模块已被删除。要解决此问题,您可以将所有的 `import tensorflow.logging as logging` 替换为 `import logging`,并在代码中使用 `logging` 代替 `tensorflow.logging`。如果您的代码是从旧版本的 TensorFlow 中移植而来的,则需要进行相应的更新。
相关问题
attributeerror: module 'tensorflow' has no attribute 'logging'
这个错误提示表明在使用 TensorFlow 模块时,没有找到 "logging" 属性。可能是因为代码中的语法错误或者版本问题造成的。建议检查代码,并确保使用的 TensorFlow 版本是正确的。
AttributeError: module 'tensorflow' has no attribute 'logging'. Did you mean: '_logging'?
This error occurs when a module in TensorFlow tries to access the attribute "logging" but it is not available. In recent versions of TensorFlow, the "logging" module has been moved to a separate package called "absl.logging".
To fix this error, you can replace any instances of "import tensorflow.logging" with "import absl.logging" and update any references to "tensorflow.logging" with "absl.logging".
For example:
```
import tensorflow as tf
tf.logging.set_verbosity(tf.logging.INFO)
# should be replaced with:
import absl.logging as logging
logging.set_verbosity(logging.INFO)
```
阅读全文