如在安裝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.')