問題如下:
AttributeError: module ‘tensorflow’ has no attribute ‘reset_default_graph’
上面是因爲安裝的Tensorflow 2不支持Tensorflow1的API而報的錯
,需要將導入模塊的部分進行更改,操作如下:
1,原本的代碼
import tensorflow as tf %這行代碼改成下面的兩行代碼
2,替換成如下代碼:
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
3,可以了,不會報錯