import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='2'
import tensorflow as tf
tf.compat.v1.disable_eager_execution()
a = tf.constant([[1.0,2.0]])
b = tf.constant([[2.0],[3.0]])
result = tf.matmul(a,b)
print(result) #tf.Tensor([[8.]], shape=(1, 1), dtype=float32)
#只会输出数据类型,不会输出结果=只构建计算图,不计算
#会话(session):可以执行计算图中的节点运算
with tf.compat.v1.Session() as sess:
print(sess.run(result))