如在安装2以上的TensorFlow想使用1的版本,只需在文件开头添加如下三行语句
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior() # 使用静态图模式运行以下代码
assert tf.__version__.startswith('2.')
如在安装2以上的TensorFlow想使用1的版本,只需在文件开头添加如下三行语句
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior() # 使用静态图模式运行以下代码
assert tf.__version__.startswith('2.')