cnn神经卷积网络No module named 'compat'

cnn卷积神经网络的时候出现No module named 'compat'

img

img

版本问题 ,试下 可以通过 tf.compat.v1.enable_* 或 tf.compat.v1.disable_* 看能兼容不,或者直接将代码改成:

# import tensorflow.compat.v1 as tf
import tensorflow as tf
tf.compat.v1.disable_eager_execution()

#......

# config = tf.ConfigProto()
# config.gpu_options.allow_growth = True
# self.sess = tf.Session(config=config)
 
config = tf.compat.v1.ConfigProto()
config.gpu_options.allow_growth = True 
self.sess = tf.compat.v1.Session(config=config)