tensorflow pip 安裝 以及nvdia-docker-tensorflow安裝

pip 安裝

  • 使用conda 創建 Python環境

conda create -n tensorflow110-py3 python==3.5

  • 安裝指定版本的tensorflow

sudo pip install tensorflow-gpu==1.10

install

sudo docker pull tensorflow/tensorflow:latest-gpu-py3

start

sudo docker run --runtime=nvidia -p 8888:8888 tensorflow/tensorflow:latest-gpu-py3

test

from __future__ import print_function
import tensorflow as tf

with tf.Session():
    input1 = tf.constant([1.0, 1.0, 1.0, 1.0])
    input2 = tf.constant([2.0, 2.0, 2.0, 2.0])
    output = tf.add(input1, input2)
    result = output.eval()
    print("result: ", result)

result:  [3. 3. 3. 3.]

學習文檔

Tensorflow中文社區 http://www.tensorfly.cn/

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章