观看Tensorflow案例实战视频课程03 基本计算单元-变量
import tensorflow as tf a=3 #Create a variable. w=tf.Variable([[0.5,1.0]]) x=tf.Variable([[2.0],[1.0]]) y=tf.matmul(w,x) #variables have to be explicitly initialized before you can run Ops init_op=tf.global_varies_initializer()#初始化 with tf.Session() as sess: sess.run(init_op) print(y.eval())