Tensorflow:UnknownError: Failed to get convolution algorithm. This is probably because cuDNN failed

今天在使用Jupyternotebook跑训练代码时遇到了这样的错误,我安装的是tensorflow2.0gpu版本,cuda10.0,cudnn只需大于v7.6即可,根据提示可能是cudnn的问题,解决方法如下:

1.先尝试restart服务器:

Tensorflow:UnknownError: Failed to get convolution algorithm. This is probably because cuDNN failed
大多数时候可以通过重启服务器解决。

2.检查cudnn安装是否正确

如果restart不管用的话,那一般就是你的cudnn出现了问题,我这次就是这样,我在安装cudnn时,只是将cuda中的文件放在cudnn文件夹中就直接复制到了cuda10.0的文件夹中,就像这样,cudnn文件在cudnn的文件夹中:Tensorflow:UnknownError: Failed to get convolution algorithm. This is probably because cuDNN failed
正确的做法是将cudnn中的文件Tensorflow:UnknownError: Failed to get convolution algorithm. This is probably because cuDNN failed
直接复制到该文件夹下,如下:
Tensorflow:UnknownError: Failed to get convolution algorithm. This is probably because cuDNN failed
这样cudnn就配置完成了,Tensorflow:UnknownError: Failed to get convolution algorithm. This is probably because cuDNN failed
此时再次运行代码成功。