Tensorflow加载模型报错 Cannot assign a device for operation...

报错

InvalidArgumentError (see above for traceback): Cannot assign a device for operation ‘tower_3_1/eval_outputs_and_metrics/foldl/while/generator/generator/rnn/while/rnn/dna_cell/assert_equal/Assert/AssertGuard/Assert’: Could not satisfy explicit device specification ‘/device:GPU:3’ because no supported kernel for GPU devices is available.

解决方法

解决方法是设置配置里面的allow_soft_placement=True

 config = tf.ConfigProto(allow_soft_placement=True)
 with tf.Session(config=config) as sess:
 	saver.restore(sess, "model-xxxx")

参考链接:

  1. https://blog.csdn.net/sushiqian/article/details/80960880
  2. https://blog.csdn.net/u012133034/article/details/78785254

你可能感兴趣的:(tensorflow,restore)