TensorFlow安装配置,茫茫人海中一瞥

本文介绍了TensorFlow在Ubuntu系统的安装方法,并提供了简单的代码示例帮助理解TensorFlow的基本使用。

深度学习的框架,我们熟知的有caffe,torch和convnet。最近,Google又搞了一个TensorFlow,已经开源:http://www.tensorflow.org/。据说,谷歌的深度学习研究人员都在用TensorFlow,未来也将在机器学习产品中继续使用。那么,作为小码农的我需要紧跟时代的步伐啊,探索一下这个新家伙。

本博文分为两个部分,第一个部分介绍TensorFlow的安装,第二部分探索一下TensorFlow的基本使用知识。

一. TensorFlow的安装

个人觉得TensorFlow的安装比前几个框架的安装简单。小码农我的系统是Ubuntu15.04,这里介绍一下Ubuntu下安装TensorFlow的方法,代码如下:

<span style="font-size:14px;"># For CPU-only version
$ pip install https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.5.0-cp27-none-linux_x86_64.whl

# For GPU-enabled version (only install this version if you have the CUDA sdk installed)
$ pip install https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.5.0-cp27-none-linux_x86_64.whl</span>


需要注意的是系统已经安装好python,假如使用的GPU,还需要把GPU的驱动安装好。GPU驱动安装可参考:http://blog.youkuaiyun.com/helei001/article/details/46950853

如果你是其他的系统,请参考网页:http://www.tensorflow.org/get_started/os_setup.md

二. TensorFlow的基本使用

TensorFlow的使用与python的运算库一样,负责与硬件打交道的是session,用来驱动GPU或者CPU。话不多说,上代码:

<span style="font-size:14px;">import tensorflow as tf
# The value returned by the constructor represents the output of the Constant op.
matrix1 = tf.constant([[3., 3.]])

# Create another Constant that produces a 2x1 matrix.
matrix2 = tf.constant([[2.],[2.]])
product = tf.matmul(matrix1, matrix2)
sess = tf.Session()
result = sess.run(product)
print result

# Close the Session when we're done.
sess.close()</span>


参考链接:

http://www.tensorflow.org/get_started


推荐资料:

[1] first-contact-with-tensorflow

[2] http://learningtensorflow.com/       

[3] https://hackerlists.com/tensorflow-resources/          

评论 9
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值