首頁  >  問答  >  主體

python - tensorflow 在windows 下怎么使用gpu ?

  1. 相关环境

  1. 代码

import tensorflow as tf

with tf.Session() as sess:
  with tf.device("/gpu:0"):
    matrix1 = tf.constant([[3., 3.]])
    matrix2 = tf.constant([[2.],[2.]])
    product = tf.matmul(matrix1, matrix2)
    result = sess.run([product])
    print(result)
  1. 错误信息

InvalidArgumentError (see above for traceback): Cannot assign a device to node 'MatMul': Could not satisfy explicit device specification '/device:GPU:0' because no devices matching that specification are registered in this process; available devices: /job:localhost/replica:0/task:0/cpu:0
         [[Node: MatMul = MatMul[T=DT_FLOAT, transpose_a=false, transpose_b=false, _device="/device:GPU:0"](Const, Const_1)]]

2017-01-08 tensorflow 在windows 下使用gpu中文教程

迷茫迷茫2711 天前863

全部回覆(1)我來回復

  • 黄舟

    黄舟2017-04-18 10:14:20

    之前的版本只能跑在docker裡,所以沒辦法用到gpu。現在新的版本已經聲明支援windows了,你只要把這些正確安裝了應該就不會有問題。

    Python3.5, TensorFlow, Cuda Toolkit 8.0, cuDNN.

    具體請看這篇文章,講的非常詳細 http://www.netinstructions.co...

    回覆
    0
  • 取消回覆