在tensorflow2.0以前的版本中我们知道要输出需要调用Session模块
import tensorflow as tf
data1 = tf.constant(2)
data2 = tf.Variable(10,name = 'var')
sess = tf.Session()
print(sess.run(data1))
而在tensorflow2.0版本中不再有Session模块
import tensorflow as tf
data1 = tf.constant(2)
data2 = tf.Variable(10,name = 'var')
tf.print(data1)
tf.print(data2)