学习进度笔记3

Posted on 2021-01-06 21:21  九天龙凤  阅读(32)  评论(0编辑  收藏  举报

观看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())