TensorFlow之helloworld(1)

HelloWorld.py

 

 1 # -*- coding=utf-8 -*-
 2 
 3 #引入TensorFlow库
 4 
 5 import tensorflow as tf
 6 
 7 #创建一个常量Operation(操作)
 8 
 9 hw = tf.constant("Hello World ! I love TensorFlow.")
10 
11 #启动一个TensorFlow的Session(会话)
12 
13 sess = tf.Session()
14 
15 #运行Graph(计算图)
16 
17 print sess.run(hw)
18 
19 #关闭Session(会话)
20 
21 sess.close()
输出结果:Hello World ! I love TensorFlow.

  

posted on 2018-09-26 22:03  qiuqiu365  阅读(118)  评论(0编辑  收藏  举报