解决tensorflow中 RuntimeError: tf.placeholder() is not compatible with eager execution

项目场景:

运行tf 1.x版本是代码报错
错误提示:
RuntimeError: tf.placeholder() is not compatible with eager execution.


解决方案:

只需增加一行代码放在前面:

tf.compat.v1.disable_eager_execution()

猜你喜欢

转载自blog.csdn.net/qq_44368508/article/details/126995149