TensorFlow入门——hello

Posted 转换无极限

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了TensorFlow入门——hello相关的知识,希望对你有一定的参考价值。

上一节说了TensorFlow的安装,这一节说一下测试的问题

新建一个Python文件,输入

1 import tensorflow as tf
2 hello = tf .constant (’Hello, TensorFlow!’)
3 sess = tf. Session()
4 print(sess.run(hello))
5 a= tf.constant(lO)
6 b = tf.constant(30)
7 print (sess. run (a + b) )

运行,代码很简单。不报错就是成功的一半,正确结果相信所有人都能知道。

以上是关于TensorFlow入门——hello的主要内容,如果未能解决你的问题,请参考以下文章