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

1.6k views Asked by At

Environment:

Windows 8.1 64 bit Python 3.7.7 64 bit TensorFlow 2.3 Keras 2.4

CUDA: 10.1 CuDNN: 7

Error : InvalidArgumentError: assertion failed: [0] [Op:Assert] name: EagerVariableNameReuse.

Problem : Above error at a simple statement model = Sequential() at GPU execution

But if I run the script without GPU (not setting CUDA/CuDnn environment variables it works as expected.

So effectively, I have a GPU but can't use with TensorFlow(2.3)

Can someone help?

1

There are 1 answers

1
thushv89 On

From what I've seen, this issue comes up for the following deadly combination.

  • Windows OS
  • TensorFlow 2.3.x

I've been struggling to solve this for quite sometime and only figured it out recently.

Easiest fix

Easiest solution would be to go for TensorFlow 2.4.0rcx. It is still in pre-release. But haven't given me the aforementioned issue. So,

pip uninstall tensorflow
pip install tensorflow==2.4.0rc0

Solution if you want to stay with TF 2.3.x

If you're really adamant about using TensorFlow 2.3.x the only solutions seem to be,

  • Trying a Linux based OS (Ubuntu)
  • Compiling TensorFlow from source (According to this helpful comment)