cnn卷积神经网络的时候出现No module named 'compat'
1条回答 默认 最新
- 元气少女缘结神 2023-03-28 14:05关注
版本问题 ,试下 可以通过 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)
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 1无用