相关环境
windows 10
python 3.5.2
tensorflow-gpu (0.12.1)
N卡960M
核显 Intel HD Graphics 4600
代码
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)
错误信息
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中文教程
之前的版本只能跑在docker里,所以没法用到gpu。现在新的版本已经声明支持windows了,你只要把这些正确安装了应该就不会有问题。
Python3.5, TensorFlow, Cuda Toolkit 8.0, cuDNN.
具体请看这篇文章,讲的非常详细 http://www.netinstructions.co...