网上大多的教程是说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. hutools密码算法库

    hutool密码算法库 一.开发背景 Hutool针对Bouncy Castle做了简化包装,用于实现国密算法中的SM2.SM3.SM4. 国密算法工具封装包括: 非对称加密和签名:SM2 摘要签名算 ...

  2. Git 工作常用操作

    撤回commit 上一次提交的代码 git reset --soft HEAD^ HEAD^的意思是上一个版本,也可以写成HEAD~1 如果你进行了2次commit,想都撤回,可以使用HEAD~2 g ...

  3. Adversarial seeded sequence growing for weakly-supervised temporal action localization概述

    0.前言 相关资料: 论文 github 论文解读 论文基本信息: 领域:弱监督时序动作定位综述 更新时间:ACM MM2019(2019.8.7) 1.针对的问题 大多数现有的框架依赖于类激活序列( ...

  4. Burp Suite入门

    Burpsuite Burp Suite是一个Web应用程序集成攻击平台,它包含了一系列burp工具,这些工具之间有大量接口可以互相通信,这样设计的目的是为了促进和提高整个攻击的效率.平台中所有工具共 ...

  5. 小程序中使用less

    小程序中使用Less 原生小程序不支持less,其他基于小程序的框架大体都支持,如wepy,mpvue,taro等.但是仅仅因为一个less功能,而且引入一个框架,肯定是不可取的.因此可以用以下方式来 ...

  6. 几个Shell脚本的例子

    [例子:001]判断输入为数字,字符或其他 #!/bin/bash read -p "Enter a number or string here:" input case $inp ...

  7. SpringBoot整合mqtt协议,实现订阅topic并将消息存储到mysql数据库

    所需依赖如下: <dependencies> <dependency> <groupId>org.springframework.boot</groupId& ...

  8. 莫凡Python之keras 2

    莫凡Python 2 kearsregressionpython Classifier 分类 使用 mnist 数据集,这是0-9的图片数据,我们使用神经网络去识别这些图片.显示图片上的数据 本质上是 ...

  9. MVC内置对象

    MVC内置函数 ----HTML页 <!DOCTYPE html> <html> <head>     <meta charset="utf-8&q ...

  10. CF546E

    这题并不是太难 首先题目我们将每个城市拆点,由源点向一端连容量为初始人数的边,由另一端向汇点连容量为最后人数的边,然后按照题目要求从一端向另一端连容量无穷大的边 这样跑出最大流之后我们只需比较这个流量 ...