Tensorflow教程:Hello World程序
打开python idle,输入:
import tensorflow as tf
# 创建常量
hello = tf.constant('Hello,world!')
# 创建会话
sess = tf.Session()
# 执行
result = sess.run(hello)
# 关闭会话
sess.close()
# 输出结果
print(result)运行后,如果得到输出b'Hello,world!',证明运行成功。
注意事项:
1、Python3.0以后,使用print result会报错,改为print(result)即可。
最后更新于1年前
本文由人工编写,AI优化,转载请注明原文地址: Tensorflow教程:Hello World程序
推荐阅读
评论 (0)
发表评论
昵称:加载中...
暂无评论,快来发表第一条评论吧!