Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I trained my custom model and used tensorflow 2.1. When I run the code I'm getting the following error:

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

Here is the line which showing the error:

self.train_accuracy = tf.keras.metrics.CategoricalAccuracy('train_accuracy')

What does this error mean, thanks in advance.

like image 386
user13307722 Avatar asked Apr 14 '20 04:04

user13307722


2 Answers

Providing the solution here even though it is present in Github, for the benefit of the Stackoverflow Community.

Whenever we are trying to run two python programs that use Tensorflow at the same time triggers this error. Please close other python session using Tensorflow will resolve this issue.

For more information please refer here.

like image 168
Tensorflow Warrior Avatar answered Nov 11 '22 06:11

Tensorflow Warrior


I had the same problem, with the following configuration:

  • Windows 10
  • GPU on GE Force MX130 with driver 451.67
  • CUDA 10.1
  • cuDNN 7.6
  • TensorFlow 2.3.0

I solved it by downgrading from TensorFlow 2.3.0 to TensorFlow 2.2.0 (as also mentioned here on Github).

like image 4
Franco Avatar answered Nov 11 '22 06:11

Franco