问题:
使用tf.enable_eager_execution()时,出现错误:
ValueError: tf.enable_eager_execution must be called at program startup.
分析:
tf.enable_eager_execution()没有跟在import tensorflow as tf后会报该错。
解决:
tf.enable_eager_execution()应紧跟在import tensorflow as tf之后。
import tensorflow as tf
tf.enable_eager_execution()