Tensorflow2.1.0下出現AttributeError: module 'tensorflow' has no attribute 'Session',完美解決!

直接上解決辦法:python import tensorflow.compat.v1 as tf # 關鍵步驟 hello = tf.constant('Hello, TensorFlow!') sess = tf.compat.v1.Session() # 關鍵步驟 print(sess.run(hello)) 緣由:這是版本問題,聽說Tensorflow2.0之後的版本必需要這樣import,
相關文章
相關標籤/搜索