Could not satisfy explicit device specification '/device:GPU:0' because no supported kernel for GPU

参考:https://blog.csdn.net/xd_wjc/article/details/80550862

windows7+Anoconda3+tensoeflow-gpu1.4+cuda8.0+cudnn6.0

启动训练文件train_image_classifier.py的时候会报Cannot assign a device for operation 'InceptionV3/AuxLogits/Conv2d_2b_1x1/weights/RMSProp1': Could not satisfy explicit device specification '/device:GPU:0' because no supported kernel for GPU devices is available类似这种错误,

翻了一些资料,可能是定义在图中的op只能在CPU中运行,GPU不支持

解决方法:

1.将以下参数由False设置为True,但是这样的话,整个程序都在CPU上运行,会很慢。所以可以用第二种方式

Could not satisfy explicit device specification '/device:GPU:0' because no supported kernel for GPU

2.设置tf.ConfigProto

config = tf.ConfigProto(allow_soft_placement = True)
sess = tf.Session(config = config)

这种方式适合在session中,如果是slim里,由于本身将session封装好了,不需要创建,所以打开train_image_classifier.py这个文件,把这个文件拉到最底,会看到slim.learing.train, 加上红圈划的两句

Could not satisfy explicit device specification '/device:GPU:0' because no supported kernel for GPU

亲测好使O(∩_∩)O哈哈~

Could not satisfy explicit device specification '/device:GPU:0' because no supported kernel for GPU