TensorFlow 2.3 GPU - InvalidArgumentError : assertion failed: [0] [Op:Assert] name: EagerVariableNameReuse

标签 tensorflow keras tensorflow2.x

环境:

window 8.1 64 位 python 3.7.7 64 位 tensorflow 2.3 喀拉斯 2.4

CUDA:10.1 CuDNN:7

错误:InvalidArgumentError:断言失败:[0] [Op:Assert] 名称:EagerVariableNameReuse

问题:在 GPU 执行时的简单语句 model = Sequential() 中出现上述错误

但如果我在没有 GPU 的情况下运行脚本(不设置 CUDA/CuDnn 环境变量,它会按预期工作。

如此有效,我有一个 GPU,但不能与 TensorFlow(2.3) 一起使用

有人可以帮忙吗?

最佳答案

据我所知,这个问题出现在以下致命组合中。

  • Windows 操作系统
  • tensorflow 2.3.x

我一直在努力解决这个问题,直到最近才弄明白。

最简单的修复

最简单的解决方案是使用 TensorFlow 2.4.0rcx。它仍处于预发布阶段。但是没有给我上述问题。所以,

pip uninstall tensorflow
pip install tensorflow==2.4.0rc0

如果你想继续使用 TF 2.3.x 的解决方案

如果您真的坚持使用 TensorFlow 2.3.x,那么唯一的解决方案似乎是,

  • 试用基于 Linux 的操作系统 (Ubuntu)
  • 从源代码编译 TensorFlow(根据 this helpful 评论)

关于TensorFlow 2.3 GPU - InvalidArgumentError : assertion failed: [0] [Op:Assert] name: EagerVariableNameReuse,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64066041/

相关文章:

python - Keras 的 fit_generator 额外训练值

python - 绘制图像分类模型的混淆矩阵

Tensorflow 2.0 不能使用 GPU,cuDNN 出问题了? :Failed to get convolution algorithm. 这可能是因为 cuDNN 初始化失败

python - tf.estimator.Estimator 中参数的混淆

python - 我们如何在Windows中将模型保存为.pb文件

python - 如何在 TensorFlow 中对自定义损失函数内的张量进行归一化?

python - LSTM 与 keras

python - 具有不同形状的多个输入的 Keras TimeDistributed

python - 如何在 GPU 上使用 Keras?

python-3.x - mse 损失函数与隐藏层输出上的正则化损失 (add_loss) 不兼容