TensorFlow学习笔记1:Hello TensorFlow!

来源:互联网 发布:qq邮箱smtp设置 端口25 编辑:程序博客网 时间:2024/06/04 19:45

根据 https://github.com/aymericdamien/TensorFlow-Examples 学习TensorFlow

import tensorflow as tfhello = tf.constant('Hello, TensorFlow!')sess = tf.Session()print(sess.run(hello))
其中第二行定义了常量hello,在TensorFlow中,tf.constant(value, dtype=None, shape=None, name='Const'),其中value表示值,dtype表示类型,shape可用于返回矩阵,向量等,name为结果的名字,tf.constant 返回一个常量张量。

第三行开始了一个session,第四行输出hello。


原创粉丝点击