报错信息
module 'tensorflow' has no attribute 'reset_default_graph'
方法:
原本的代码import tensorflow as tf,改为
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
报错: AttributeError: module 'tensorflow_core._api.v2.train' has no attribute 'GradientDescentOptimizer'
此时应改为:
optimizer = tf.compat.v1.train.GradientDescentOptimizer
module 'tensorflow.compat.v1' has no attribute 'contrib'【TensorFlow 2.x】解决方法
原因是TensorFlow 2.x之后把contrib这个库取消了