Bibliothèque d'apprentissage automatique fournie par Google @ shuhei_f Qu'est-ce que TensorFlow est facile à comprendre.
Préparez Ubuntu avec Créer un environnement Ubuntu avec Vagrant + VirtualBox.
Ubuntu 15.04 / Python 2.7.9
$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=15.04
DISTRIB_CODENAME=vivid
DISTRIB_DESCRIPTION="Ubuntu 15.04"
$ python --version
Python 2.7.9
$ export http_proxy="$USERNAME:$PASSWORD@$HOST:$PORT"
$ export https_proxy="$USERNAME:$PASSWORD@$HOST:$PORT"
$ curl -kL https://raw.github.com/pypa/pip/master/contrib/get-pip.py | sudo python
$ sudo pip install virtualenv
$ mkdir ~/tensorflow
$ virtualenv --system-site-packages ~/tensorflow
$ cd ~/tensorflow
$ source bin/activate
(tensorflow)$ sudo pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.5.0-cp27-none-linux_x86_64.whl
Si vous obtenez l'erreur suivante, cela signifie que "python-dev" n'est pas inclus.
Installez avec sudo apt-get install python-dev
.
(Omis)
SystemError: Cannot compile 'Python.h'. Perhaps you need to install python-dev|python-devel.
----------------------------------------
Command "/usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-ZZhjh_/numpy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-UmWBtU-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-ZZhjh_/numpy
hello-tf.py
import tensorflow as tf
import multiprocessing as mp
core_num = mp.cpu_count()
config = tf.ConfigProto(
inter_op_parallelism_threads=core_num,
intra_op_parallelism_threads=core_num )
sess = tf.Session(config=config)
hello = tf.constant('hello, tensorflow!')
print sess.run(hello)
a = tf.constant(10)
b = tf.constant(32)
print sess.run(a+b)
(tensorflow)$ python hello-tf.py
I tensorflow/core/common_runtime/local_device.cc:25] Local device intra op parallelism threads: 2
I tensorflow/core/common_runtime/local_session.cc:45] Local session inter op parallelism threads: 2
hello, tensorflow!
42
Vagrantfile
config.vm.network :forwarded_port, host: 6006, guest: 6006
$ vagrant reload
$ tensorboard --logdir=[log_dir]
Starting TensorBoard on port 6006
(You can navigate to http://localhost:6006)
L'installation de Pip est devenue plus facile avant que je ne le sache J'ai essayé d'exécuter Hello World avec TensorFlow et son explication
Recommended Posts