import tensorflow as tf
tf.compat.v1.disable_eager_execution() #注意,此語句非常重要篷扩,否則回出現(xiàn)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