InvalidArgumentError (see above for traceback): Cannot assign a device for operation ‘gradients/aux_loss/xentropy_grad/LogSoftmax’: Could not satisfy explicit device specification ‘/device:GPU:0’ because no supported kernel for GPU devices is available.
Registered kernels:
device=‘CPU’; T in [DT_HALF]
device=‘CPU’; T in [DT_FLOAT]
device=‘CPU’; T in [DT_DOUBLE]
[[Node: gradients/aux_loss/xentropy_grad/LogSoftmax = LogSoftmaxT=DT_FLOAT, _device="/device:GPU:0"]]
解决办法:
在train_image_classifier中加入一句:
config = tf.ConfigProto(allow_soft_placement = True)
然后在最后的定义中:
slim.learning.train(
train_tensor,
......
session_config = config
)
加粗的这句话即可
原文:https://blog.csdn.net/qq_29417013/article/details/80992205