解决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()

你可能感兴趣的:(tensorflow,tensorflow,python,深度学习)