想运行这行代码
tf.reset_default_graph()
然后出了错
AttributeError: module ‘tensorflow’ has no attribute ‘reset_default_graph’
解决方法:
将导包部分的
import tensorflow as tf
更改为
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
更:
我的TensorFlow版本是2.4.0
运行截图: