[ML] TensorFlow 安裝

程式語言:Python
Package:tensorflow
官網

簡介:library for ML

限制

  • 只支援 Python 2.7 跟 Python 3.3+
  • Windows 只支援 64bit Python 3.5
  • 從 1.6 開始,從 AVX 編譯二進位制檔案
    若 CPU 不支援 AVX ,請安裝 1.5
    pip install tensorflow==1.5.0
    

前置作業


Linux
# Ubuntu/Linux 64-bit
sudo apt-get install python-pip python-dev
Window
安裝 Visual C++ 2015 redistributable (x64 version)


安裝

# CPU only
pip install tensorflow

# GPU support
# The GPU version works best with Cuda Toolkit 8.0 and cuDNN v5.1
pip install tensorflow-gpu

測試

import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()

print(sess.run(hello))
# Hello, TensorFlow!

a = tf.constant(10)
b = tf.constant(32)

print(sess.run(a + b))
# 42
python -m tensorflow.models.image.mnist.convolutional

留言