import tensorflow.compat.v1 as tf
tf.compat.v1.disable_eager_execution()
或
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
替换import tensorflow as tf
2023-10-10 20:47:52
import tensorflow.compat.v1 as tf
tf.compat.v1.disable_eager_execution()
或
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
替换import tensorflow as tf