网上大多的教程是说tensorflow的版本过高,或者说cuda和cudnn的版本不对,需要降级,但这样会很麻烦!!!

以下值得推荐!!!

解决方法一:在代码前加上下面的代码

from tensorflow.compat.v1 import ConfigProto
from tensorflow.compat.v1 import InteractiveSession
config = ConfigProto()
config.gpu_options.allow_growth = True
session = InteractiveSession(config=config)

解决方法二:添加下面两行

import os

os.environ['CUDA_VISIBLE_DEVICES'] = '/gpu:0'

或者

添加

import os

os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"

os.environ['CUDA_VISIBLE_DEVICES'] = "0,1"//选择哪一块gpu,如果是-1,就是调用cpu

config = tf.ConfigProto()//对session进行参数配置

config.allow_soft_placement=True : 如果你指定的设备不存在,允许TF自动分配设备

config.gpu_options.per_process_gpu_memory_fraction=0.7//分配百分之七十的显存给程序使用,避免内存溢出,可以自己调整

config.gpu_options.allow_growth = True//按需分配显存,这个比较重要

session = tf.Session(config=config)

解决方法三:TensorFlow GPU版出现ResourceExhaustedError:OOM错误的问题

一是、将图片尺寸改小,小到占用的内存比显存。

二是、不使用GPU进行预测,只使用CPU预测,因为一般CPU内存要大于显存的。但装的又是GPU版的TensorFlow,所以需要在预测程序进行更改。

程序在前两行加入下面代码:

import os
os.environ["CUDA_VISIBLE_DEVICES"= ""

引号里填的是GPU的序号,不填的时候代表不使用GPU。

tensorflow出现Failed to get convolution algorithm, cuDNN failed to initialize的更多相关文章

  1. Error : Failed to get convolution algorithm. This is probably because cuDNN failed to initialize

    记录一下: 报错:# Error : Failed to get convolution algorithm. This is probably because cuDNN failed to ini ...

  2. 出现Failed to get convolution algorithm的解决方法

    当运行卷积神经时出现了问题:Failed to get convolution algorithm. This is probably because cuDNN failed to initiali ...

  3. Failed to get convolution algorithm解决

    蒸腾了两天,终于搞定了 是cudnn版本的问题 更新cudnn的时候,首先要删除/usr/local/cuda-10.0/targets/x86_64-linux/lib路径下所有之前cudnn版本的 ...

  4. [异常解决] windows用SSH和linux同步文件&linux开启SSH&ssh client 报 algorithm negotiation failed的解决方法之一

    1.安装.配置与启动 SSH分客户端openssh-client和openssh-server 如果你只是想登陆别的机器的SSH只需要安装openssh-client(ubuntu有默认安装,如果没有 ...

  5. Debian 8 jessie, OpenSSH ssh connection server responded Algorithm negotiation failed

    安装了debian 8.5 就出问题了. root@debian8:~# lsb_release -aNo LSB modules are available.Distributor ID: Debi ...

  6. SSH Secure File Transfer Client连接远程设备报“algorithm negotiation failed”错的解决方法

    SSH Secure File Transfer Client连接远程设备报"algorithm negotiation failed"错的解决方法 ssh client 报 al ...

  7. SSH Secure :Algorithm negotiation failed,反复提示输入password对话框

    在嵌入式开发中,SSH Secure File Transfer Client 软件使用,方便了windows和linux之间文件拷贝,尤其是多台主机状况下. 最近装了Ubuntu 16.0.4,在V ...

  8. Server responded "Algorithm negotiation failed" SSH Secure链接服务器错误

    Ubuntu 16.04安装openssh-server后,使用ssh客户端连接时可能报此错误,情况如下图所示: server responded "algorithm negotiatio ...

  9. Algorithm negotiation failed

    #用pycharm工具ssh client 报 algorithm negotiation failed#导致原因:是ssh升级后,为了安全,默认不再采用原来一些加密算法,我们手工添加进去即可#目前出 ...

  10. php file_get_contents失败[function.file-get-contents]: failed to open stream: HTTP request failed!解决

    在使用file_get_contents方法来获取远程文件时会出现 [function.file-get-contents]: failed to open stream: HTTP request ...

随机推荐

  1. pypi镜像-清华

    临时使用 pip install -i https://pypi.tuna.tsinghua.edu.cn/simple some-package 注意,simple 不能少, 是 https 而不是 ...

  2. css代码中的2个类名连一起写是啥意思?

    <div class="menu-btn closed"> <div class="menu-line"></div> &l ...

  3. C语言 数据编码方式

    一.整形数据类型 1.无符号数的编码 无符号数指的是整个机器字长的全部位数均表示数值位. 我们用函数      来进行运算.(B2U是Binary to Unsigned的缩写,长度为w),x代表为0 ...

  4. drf从入门到飞升仙界 04

    序列化类常用字段和字段参数 常用字段类 #1 BooleanField BooleanField() #2 NullBooleanField NullBooleanField() #3 CharFie ...

  5. Android中保存文件到内部存储器

    1 public static void saveDataToPrivateFile(Context context, String data, int mode, String fileName) ...

  6. Ubuntu20.04 TLS 开机卡在“A start job is running for wait for network to be Configured”解决

    问题: 安装ubuntu20.04 TLS系统后,开机卡在"A start job is running for wait for network to be Configured" ...

  7. CF1557总结

    CF1557总结 Codeforces Round #737 (Div. 2) 先看了 A .意思是要把序列分成两个子序列,使得两序列各自平均值的和最小,输出最小值,要求 \(O(n)\) .想半天然 ...

  8. flutter List使用

    _tabbarTitile.map((e){ return Tab( text: e, ); }).toList(),

  9. 给定两个字符串,均只包含英文字母,需区分大小写,一个是源字符串SS(长度<1000), 另一个是目标字符串TS(长度<1000),请问能否通过删除SS中的字符(不改变顺序)将它变换成TS,如果可以输出“YES",不可以则输出“NO"。 输入说明:第一行为源字符串SS,第二行为目标字符串TS。

    import java.util.Scanner;/*    给定两个字符串,均只包含英文字母,需区分大小写,一个是源字符串SS(长度<1000),    另一个是目标字符串TS(长度<1 ...

  10. React Native面试知识点

    1.React Native相对于原生的ios和Android有哪些优势? 1.性能媲美原生APP 2.使用JavaScript编码,只要学习这一种语言 3.绝大部分代码安卓和IOS都能共用 4.组件 ...