tensorflow中的session

2.0版本tf.Session()不能使用

解决办法:

import tensorflow as tf
tf.compat.v1.disable_eager_execution()
hello = tf.constant('hello')
sess = tf.compat.v1.Session()
print(sess.run(hello))
posted @ 2020-09-28 23:26  鼬神无悔  阅读(487)  评论(0)    收藏  举报