报错内容
tensorflow.python.framework.errors_impl.UnknownError: Failed to get convolution algorithm. This is probably because cuDNN failed to initialize, so try looking to see if a warning log message was printed above.
网上文章都是说cudnn版本不匹配,但是查了之后发现不是这个问题。
https://www.tensorflow.org/in...
然后看到了一篇博客说到可能是因为显存不足,导致的。
限制GPU的使用率
方法一
config = tf.ConfigProto()
config.gpu_options.per_process_gpu_memory_fraction = 0.85 #占用85%显存
session = tf.Session(config=config)
方法二
gpu_options=tf.GPUOptions(per_process_gpu_memory_fraction=0.85)
config=tf.ConfigProto(gpu_options=gpu_options)
session = tf.Session(config=config)
参考文章
“Failed to get convolution algorithm. This is probably because cuDNN failed to initialize”错误的解决办法