【发布时间】:2017-08-07 22:20:15
【问题描述】:
所以,我收到以下错误:
" 无法为操作“Bincount_1”分配设备:无法满足明确的设备规范“/device:GPU:0”,因为没有支持的 GPU 设备内核可用。 [[节点:Bincount_1 = Bincount[T=DT_INT32, _device="/device:GPU:0"](ToInt32_1, Minimum_1, Const_7)]] "
对我来说,这很奇怪。因为我正在尝试运行以下代码:
import numpy as np
import tensorflow as tf
K = 4
with tf.device('/gpu:0'):
X = tf.constant(np.array([1,2,2,2,2,1,1,1,1,0,0,0,3,3,3,2,1,2,0]))
count = tf.bincount(tf.to_int32(X), minlength = 4, maxlength = 4)
sess = tf.Session(config = tf.ConfigProto( log_device_placement = True ) )
print( sess.run(count) )
对我来说奇怪的是,当我运行稍微不同的代码时,它可以工作:
import numpy as np
import tensorflow as tf
K = 4
X = tf.constant(np.array([1,2,2,2,2,1,1,1,1,0,0,0,3,3,3,2,1,2,0]))
count = tf.bincount(tf.to_int32(X), minlength = 4, maxlength = 4)
sess = tf.Session(config = tf.ConfigProto( log_device_placement = True ) )
print( sess.run(count) )
而且,如果我删除 tf.bincount 函数,它也可以工作。
所以我的问题是,为什么 tf.bincount 在尝试使用设备放置时会导致错误?
我真的需要这个功能才能工作。 另外,我正在运行的系统是一个 8 K-40 GPUs with python3, tensorflow 1.2 。
【问题讨论】:
标签: python-3.x tensorflow