tensorflow' has no attribute 'initialize_all_variables
时间: 2023-07-31 17:09:15 浏览: 123
问题解决:module 'tensorflow.compat.v1' has no attribute '
5星 · 资源好评率100%
The error message "tensorflow' has no attribute 'initialize_all_variables'" typically occurs when using a newer version of TensorFlow. The `initialize_all_variables` function was deprecated in earlier versions of TensorFlow and has been removed in recent versions.
To resolve this issue, you can replace `initialize_all_variables` with `global_variables_initializer` like this:
```python
import tensorflow as tf
# Your code here
init = tf.global_variables_initializer()
```
Make sure to update your code to use the latest TensorFlow API.
阅读全文