Tensorflow được viết bằng C++ và Python. Có nhiều cách để cài đặt Tensorflow, chạy trên 1 hoặc nhiều CPU, GPU, di chuyển desktop, mobile lên server mà không cần phải code lại.

Yêu cầu hệ thống
- Tensorflow hỗ trợ Python 2.7 và Python 3.3+, do tôi dùng Ubuntu lên Python được cài đặt sẵn.
- Bản Tensorflow GPU cần cài đặt Cuda Toolkit 7.0 và cuDNN v2. Xem hướng dẫn cài tại đây.
Cài thông qua pip
Pip là trình quản lý các module của python.
Cài pip:
# Ubuntu/Linux 64-bit
$ sudo apt-get install python-pip python-dev
# Mac OS X
$ sudo easy_install pip
Sau đó cài Tensorflow:
# Ubuntu/Linux 64-bit, CPU only: $ sudo pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.6.0-cp27-none-linux_x86_64.whl
# Ubuntu/Linux 64-bit, GPU enabled: $ sudo pip install --upgrade https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.6.0-cp27-none-linux_x86_64.whl
# Mac OS X, CPU only:
$ sudo easy_install --upgrade six
$ sudo pip install --upgrade https://storage.googleapis.com/tensorflow/mac/tensorflow-0.6.0-py2-none-any.whl
Kiểm tra cài đặt
Kiểm tra xem Tensorflow đã được cài đặt thành công hay chưa. Mở terminal và gõ thử các lệnh python sau. Nếu báo lỗi tức là cài đặt không thành công.$ python
...
>>> 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
>>>
Tôi là Duyệt