1. 程式人生 > >Could not satisfy explicit device specification '/device:GPU:0' because no supported kernel for GPU

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上執行,會很慢。所以可以用第二種方式

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, 加上紅圈劃的兩句

親測好使O(∩_∩)O哈哈~

在這裡插入圖片描述

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上執行,會很慢。所以可以用第二種方式

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, 加上紅圈劃的兩句