Tensorflow2.0 Failed to get convolution algorithm. cudnn failed to initialize

在跟着视频写代码时,一个很小的卷积test竟然出现如下错误:

这个问题困扰了我将近两天,查阅了各种网页,尝试了各种方法,建议首先打开任务管理器,查看在运行代码的时候,GPU的占用情况如何,发现果然是我的GPU内存不足了,那么这个时候,就应该搜索tensorflow2.0 gpu out of memory如何处理:

法一:加上这两句话,但之后的运行时好时坏

 physical_device = tf.config.experimental.list_physical_devices("GPU")
 tf.config.experimental.set_memory_growth(physical_device[0], True)

法二:加上这几句话,意思大概也是运行内存增加

physical_devices = tf.config.experimental.list_physical_devices('GPU')
if len(physical_devices) > 0:

     for k in range(len(physical_devices)):

         tf.config.experimental.set_memory_growth(physical_devices[k], True)

     print('memory growth:', tf.config.experimental.get_memory_growth(physical_devices[k]))
else:
     print("Not enough GPU hardware devices available")

踩过的坑:以为是cuda和cudnn之间不匹配的关系,如果是的话,可以参考这篇文章:(13条消息) tensorflow-gpu2.0报错:Failed to get convolution algorithm. This is probably because cuDNN..._Raver & Leaper的博客-CSDN博客

继续探索中。。。

 

 

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值