失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > tensorflow-gpu2.x无法检测到GPU设备

tensorflow-gpu2.x无法检测到GPU设备

时间:2024-04-17 11:53:27

相关推荐

tensorflow-gpu2.x无法检测到GPU设备

tensorflow-gpu2.x无法检测到GPU设备

1.检查

在解决问题前检查一下tensorflow是否只能检查到CPU,而无法检查到GPU,而非无法调用GPU。

import tensorflow as tfprint(tf.test.is_gpu_available())gpus = tf.config.experimental.list_physical_devices(device_type='GPU')cpus = tf.config.experimental.list_physical_devices(device_type='CPU')print(gpus, cpus)#打印结果为 #False #[] [PhysicalDevice(name='/physical_device:CPU:0', device_type='CPU')]

2.解决方法

2.1问题一:没安装对应的cudnn和cudatoolkit依赖

解决办法:安装对应的cudnn和cudatoolkit

这个我就不重述了我博文里面有:/qq_43203949/article/details/108479784.

注意我的安装环境是:其中Driver Version: 441.83 NVIDIA-SMI 441.83没有绝对的要求。

2.2问题二:安装了对应的依赖却缺失了关键文件(cudnn64_7.dll)

如发生一下问题:(在pycharm的红色字体报告中可以看到)

Could not load dynamic library 'cudnn64_7.dll'; dlerror: cudnn64_7.dll not found

解决办法:去英伟达那里下载对应的cudnn文件,并将缺失文件拷贝到对应的文件夹中即可。

这个我就不重述了,我这个也写了一个博文:

/qq_43203949/article/details/108550960.

如果觉得《tensorflow-gpu2.x无法检测到GPU设备》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。