tensorflow2.1 InvalidArgumentError:断言失败:[0] [Op:Assert] 名称:EagerVariableNameReuse

use*_*722 6 python tensorflow

我训练了我的自定义模型并使用了 tensorflow 2.1。当我运行代码时,出现以下错误:

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

这是显示错误的行:

self.train_accuracy = tf.keras.metrics.CategoricalAccuracy('train_accuracy')
Run Code Online (Sandbox Code Playgroud)

这个错误是什么意思,提前致谢。

小智 4

尽管该解决方案存在于 Github 中,但为了 Stackoverflow 社区的利益,请在此提供该解决方案。

每当我们尝试同时运行两个使用 Tensorflow 的 python 程序时,就会触发此错误。请使用 Tensorflow 关闭其他 python 会话将解决此问题。

欲了解更多信息,请参阅此处