tensorflow2.0出现错误AttributeError: module ‘tensorflow’ has no attribute ‘enable_eager_execution’
错误代码:
启用动态图机制
tf.enable_eager_execution()
如图所示:
错误原因:
如果tensorflow为 2.0 版本 移除 了直接调用 enable_eager_execution() 的方式。
新版本2.0加入了 eager模式,不需要调用。
解决办法:
把tf.enable_eager_execution()删去就好。
或者改为:
tf.compat.v1.enable_eager_execution()