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) )

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

猜你喜欢

转载自www.cnblogs.com/jourluohua/p/9125878.html