在没有 pb 的情况下安装后,我正在尝试有关 GPU 的教程:我输入:
with tf.device('/gpu:0'):
a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a')
b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b')
c = tf.matmul(a, b)
print(c)
sess.run(c)
我有 :
Tensor("MatMul_1:0", shape=TensorShape([Dimension(2), Dimension(2)]), dtype=float32, device=/gpu:0)
.
Traceback(最近一次调用最后):文件“”,第 1 行,在文件“/home/olivier/anaconda/lib/python2.7/site-packages/tensorflow/python/client/session.py”,第 345 行,在运行结果 = self._do_run(target_list, unique_fetch_targets, feed_dict_string) 文件“/home/olivier/anaconda/lib/python2.7/site-packages/tensorflow/python/client/session.py”,第 419 行,在 _do_run e。代码)tensorflow.python.framework.errors.InvalidArgumentError:无法将设备分配给节点'b_1':无法满足显式设备规范'/gpu:0' [[节点:b_1 = Constdtype = DT_FLOAT,value = Tensor,_device = "/gpu:0"]] 由 op u'b_1' 引起,定义在:文件 "",第 3 行,文件 "/home/olivier/anaconda/lib/python2.7/site-packages/tensorflow/python/操作/常量操作。py",第 147 行,常量 attrs={"value": tensor_value, "dtype": dtype_value}, name=name).outputs[0] 文件 "/home/olivier/anaconda/lib/python2.7/site- packages/tensorflow/python/framework/ops.py”,第 1710 行,在 create_op original_op=self._default_original_op, op_def=op_def) 文件“/home/olivier/anaconda/lib/python2.7/site-packages/tensorflow/python /framework/ops.py”,第 988 行,在7/site-packages/tensorflow/python/framework/ops.py”,第 988 行,在7/site-packages/tensorflow/python/framework/ops.py”,第 988 行,在初始化 self._traceback = _extract_stack()
在 Torch7 中,我的 GPU 工作正常