首页 > 代码库 > TensorFlow简单介绍和在centos上的安装
TensorFlow简单介绍和在centos上的安装
##tensorflow简单介绍:
TensorFlow? is an open source software library for numerical computation using data flow graphs.https://www.tensorflow.org/
TensorFlow是谷歌基于DistBelief进行研发的第二代人工智能学习系统,其命名来源于本身的运行原理。Tensor(张量)意味着N维数组,Flow(流)意味着基于数据流图的计算,TensorFlow为张量从图象的一端流动到另一端计算过程。
选择virtualenv install的方法;TensorFlow支持CNN、RNN和LSTM算法,这都是目前在Image,Speech和NLP最流行的深度神经网络模型。
##tensorflow安装步骤:
[biostack@localhost.localdomain ylHe_test]$ virtualenv --system-site-packages ~/tensorflow
New python executable in /home/biostack/tensorflow/bin/python
Installing Setuptools..............................................................................................................................................................................................................................done.
Installing Pip.....................................................................................................................................................................................................................................................................................................................................done.
[biostack@localhost.localdomain ylHe_test]$ source ~/tensorflow/bin/activate
(tensorflow)[biostack@localhost.localdomain ylHe_test]$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.11.0rc1-cp27-none-linux_x86_64.whl
(tensorflow)[biostack@localhost.localdomain ylHe_test]$ sudo pip install --upgrade $TF_BINARY_URL --trusted-host pypi.douban.com
Collecting tensorflow==0.11.0rc1 from https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.11.0rc1-cp27-none-linux_x86_64.whl
Using cached https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.11.0rc1-cp27-none-linux_x86_64.whl
Requirement already up-to-date: six>=1.10.0 in /usr/lib/python2.7/site-packages (from tensorflow==0.11.0rc1)
Collecting wheel (from tensorflow==0.11.0rc1)
Downloading http://pypi.doubanio.com/packages/8a/e9/8468cd68b582b06ef554be0b96b59f59779627131aad48f8a5bce4b13450/wheel-0.29.0-py2.py3-none-any.whl (66kB)
100% |████████████████████████████████| 71kB 3.4MB/s
Collecting mock>=2.0.0 (from tensorflow==0.11.0rc1)
Downloading http://pypi.doubanio.com/packages/e6/35/f187bdf23be87092bd0f1200d43d23076cee4d0dec109f195173fd3ebc79/mock-2.0.0-py2.py3-none-any.whl (56kB)
100% |████████████████████████████████| 61kB 2.7MB/s
Collecting numpy>=1.11.0 (from tensorflow==0.11.0rc1)
Downloading http://pypi.doubanio.com/packages/5e/d5/3433e015f3e4a1f309dbb110e8557947f68887fe9b8438d50a4b7790a954/numpy-1.11.2-cp27-cp27mu-manylinux1_x86_64.whl (15.3MB)
100% |████████████████████████████████| 15.3MB 4.3MB/s
Collecting protobuf==3.0.0 (from tensorflow==0.11.0rc1)
Downloading http://pypi.doubanio.com/packages/97/e4/b2e4c62394cf1bf69b6b1261a0e8d864672a8b9c975a1bc2803fda2c35b7/protobuf-3.0.0-py2.py3-none-any.whl (342kB)
100% |████████████████████████████████| 348kB 4.1MB/s
Collecting funcsigs>=1; python_version < "3.3" (from mock>=2.0.0->tensorflow==0.11.0rc1)
Downloading http://pypi.doubanio.com/packages/69/cb/f5be453359271714c01b9bd06126eaf2e368f1fddfff30818754b5ac2328/funcsigs-1.0.2-py2.py3-none-any.whl
Collecting pbr>=0.11 (from mock>=2.0.0->tensorflow==0.11.0rc1)
Downloading http://pypi.doubanio.com/packages/b8/a1/7abb01fd93d66fc71e24e5df9ca6d7d9acfb4b715937d2a38fd739f266e6/pbr-1.10.0-py2.py3-none-any.whl (96kB)
100% |████████████████████████████████| 102kB 2.9MB/s
Collecting setuptools (from protobuf==3.0.0->tensorflow==0.11.0rc1)
Downloading http://pypi.doubanio.com/packages/74/c5/c78a788e65f9eb241c531839e909df1226534ea2d09d300231766b82b79a/setuptools-28.7.1-py2.py3-none-any.whl (472kB)
100% |████████████████████████████████| 481kB 4.7MB/s
Installing collected packages: wheel, funcsigs, pbr, mock, numpy, setuptools, protobuf, tensorflow
Found existing installation: mock 1.0.1
Uninstalling mock-1.0.1:
Successfully uninstalled mock-1.0.1
Found existing installation: numpy 1.11.1
Uninstalling numpy-1.11.1:
Successfully uninstalled numpy-1.11.1
Found existing installation: setuptools 24.0.3
Uninstalling setuptools-24.0.3:
Successfully uninstalled setuptools-24.0.3
Successfully installed funcsigs-1.0.2 mock-2.0.0 numpy-1.11.2 pbr-1.10.0 protobuf-3.0.0 setuptools-28.7.1 tensorflow-0.11.0rc1 wheel-0.29.0
##简单的测试
(tensorflow)[biostack@localhost.localdomain ylHe_test]$ python
Python 2.7.5 (default, Sep 15 2016, 22:37:39)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
>>> hello = tf.constant("hello,tensorflow")
>>> sess = tf.Session()
>>> print(sess.run(hello))
hello,tensorflow
>>> exit()
学习连接:http://blog.csdn.net/lynnandwei/article/details/51722119
TensorFlow简单介绍和在centos上的安装