python - 在 virtualenv : module 'tensorflow' has no attribute 'truncated_normal' 中运行tensorflow时出错

标签 python tensorflow keras

运行keras制作的CNN时出现以下错误

File "venv/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py", line 4185, in truncated_normal return tf.truncated_normal(shape, mean, stddev, dtype=dtype, seed=seed) AttributeError: module 'tensorflow' has no attribute 'truncated_normal'

我已经安装并重新安装了 Tensorflow 2.0 多次。可能会发生什么?

最佳答案

在 Tensorflow v2.0 及更高版本中,“tf.truncated_normal”替换为“tf.random.truncated_normal

关于python - 在 virtualenv : module 'tensorflow' has no attribute 'truncated_normal' 中运行tensorflow时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58341433/

相关文章:

python - 加权分类交叉熵语义分割

python - 在文本小部件中标记 - tkinter

python - 最新的 Python 版本缺少更新的库,如何处理?

python - 为什么 << export PYTHONPATH=$PYTHONPATH >> 将当前工作目录放在 sys.path 上?

jquery - 使用 python、jQuery 和 AppEngine 对按钮单击响应进行重定向(使用 http post)

ios - 将 UIImage 转换为 Keras 模型的 MLMultiArray

python - 如何获取 keras 模型的输出作为数值,而不是 Tensor 对象?

python - Tensorflow 在 CPU 而不是 RTX 3000 系列 GPU 上训练

c# - 将基于 Python 的 TensorFlow 集成到 .NET 应用程序中

python - keras 卷积层中的内核大小是如何定义的?