我爱编程

TensorFlow (一)

2017-04-06  本文已影响52人  就天边

参考:

http://www.tensorfly.cn/tfdoc/get_started/os_setup.html
http://hacker.duanshishi.com/?p=1639

示例代码——hellworld

https://github.com/jiutianbian/tensorflow-learning/blob/master/tensorflow_helloworld.py

一、TensorFlow是什么

TensorFlow是一个采用数据流图(data flow graphs),用于数值计算的开源软件库。
TensorFlow是Google发布的人工智能系统,该系统允许我们进行神经网络的构建和训练。

二、TensorFlow用来干什么

TensorFlow 的用途不仅限于机器学习,它可在蛋白质折叠、天文学数据资料处理等一系列科研领域帮助研究者理清复杂数据。

三、TensorFlow下载安装

MAC,Python

  1. TensorFlow 支持 C, C++, Python 编程语言. 目前, TensorFlow 的 Python 库更加易用
  2. TensorFlow Python API 依赖 Python 2.7 以上版本.
  3. mac自带python库,可以通过命令行查看python版本信息
python -V 

在Mac下最简单的TensorFlow Python API安装方式, 是使用 pip 安装.

四、TensorFlow——helloworld

代码

新建python文件tensorflow_helloworld.py,录入如下代码

#coding=utf-8
# 导入已经通过pip 安装了的tensorflow框架
import tensorflow as tf
# 通过constant命令新建一个tensorflow常量
hello = tf.constant('你好,德玛西亚!')
# 通过Session命令新建会话
sess = tf.Session()
print sess.run(hello)

运行

命令行之行如下命令

python xxx/xxxx/tensorflow_helloworld.py

执行结果

命令后输出

你好,德玛西亚!
上一篇 下一篇

猜你喜欢

热点阅读