import tensorflow as tf
tf.compat.v1.disable_eager_execution() #注意,此语句非常重要,否则回出现RuntimeError: The Session graph is empty.
hello = tf.constant('Hello, TensorFlow!')
sess = tf.compat.v1.Session()
t=sess.run(hello)
print(t)
a = tf.constant(10)
b = tf.constant(32)
print(sess.run(a+b))
image.png