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
参考:https://blog.csdn.net/weixin_43103344/article/details/105503930
只用把最上面注释替换就行了
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
只用把最上面注释替换就行了