tensorflow报错Cannot assign a device for operation xxxxxx Could not satisfy explicit device解决方法

tensorflow报错Cannot assign a device for operation xxxxxx Could not satisfy explicit device specification '/device:GPU:0' because no supported kernel for GPU devices is available的解决方法

前情提要

在使用tensorflow运行ImageNet时报错
Cannot assign a device for operation ‘InceptionV3/AuxLogits/Conv2d_2b_1x1/weights/RMSProp_1’: Could not satisfy explicit device specification ‘/device:GPU:0’ because no supported kernel for GPU devices is available.
在这里插入图片描述
有时报错CUDNN_STATUS_NOT_INITIALIZED,原因不明,但已经确认CUDA版本和CUDNN版本正确并且正确配置。

我的配置

  1. Windows 10 家庭中文版(64位)
  2. I7 [email protected]
  3. 16G DDR4
  4. GTX1050ti(4G)
  5. python3.5+tensorflow_gpu-1.4.0
  6. CUDA8.0+CUDNN6.0

解决方法

#修改代码

    ###########################
    # Kicks off the training. #
    ###########################
    config=tf.ConfigProto(allow_soft_placement=True)#修改这里
    slim.learning.train(
        train_tensor,
        logdir=FLAGS.train_dir,
        master=FLAGS.master,
        is_chief=(FLAGS.task == 0),
        init_fn=_get_init_fn(),
        summary_op=summary_op,
        number_of_steps=FLAGS.max_number_of_steps,
        log_every_n_steps=FLAGS.log_every_n_steps,
        save_summaries_secs=FLAGS.save_summaries_secs,
        save_interval_secs=FLAGS.save_interval_secs,
        sync_optimizer=optimizer if FLAGS.sync_replicas else None,
        session_config=config)

修改后错误消除,可以正常运行。
共同学习,一起进步!

发布了17 篇原创文章 · 获赞 24 · 访问量 5482

猜你喜欢

转载自blog.csdn.net/whstudio123/article/details/86560448