您的位置:首页 > 大数据 > 人工智能

解决UnknownError: Failed to get convolution algorithm. This is probably because cuDNN failed to initia

2020-05-11 04:09 1906 查看

解决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. [Op:Conv2D]

使用Tensorflow2.0-GPU版本时调用卷积层报错 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. [Op:Conv2D]

原因是使用单个GPU设备运行Tensorflow自动占满显存,导致cuDNN无法运行。

解决方案:限制tf的显存占用

gpus = tf.config.experimental.list_physical_devices('GPU')
if gpus:
try:
#创建虚拟显卡
tf.config.experimental.set_virtual_device_configuration(
gpus[0],
[tf.config.experimental.VirtualDeviceConfiguration(memory_limit=4096)])#限制量/MB,4096为4G
logical_gpus = tf.config.experimental.list_logical_devices('GPU')
print(len(gpus), "Physical GPUs,", len(logical_gpus), "Logical GPUs")
except RuntimeError as e:
print(e)

参考资料

https://blog.csdn.net/jackhh1/article/details/102864524

自云 原创文章 1获赞 0访问量 24 关注 私信
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐