网上大多的教程是说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. RxJava简要分析

    一:RxJava执行流程: RxJava简单使用 private final String tag = getClass().getSimpleName(); //数据源,被观察对象 Observab ...

  2. nginx调试和location用法,匹配url

    1.nginx调试输出内容到页面 location = /demo { charset utf-8; default_type text/html; return 500 "服务正在升级,请 ...

  3. nginx 解决 405 not allowed错误

    1.http nginx.conf文件 error_page 后 增加代码 error_page 405 =200 @405; location @405 { proxy_method GET; pr ...

  4. js中构造函数中this指向问题

    构造函数构造函数中的this指向new创建的新对象function FOO(name) {this.name = name;console.log(this) // Foo {name: " ...

  5. Hbase 报错hbase Could not start zk requested port of 2181

    windows下面   解决: 1. conf/hbase-env.cmd set HBASE_MANAGES_ZK=false 2. 先启动Hbase start-Hbase.cmd 再启动 zoo ...

  6. 每日一抄 Go语言封装qsort快速排序函数

    package qsort /* <GO语言高级编程>设计中案例,仅作为笔记进行收藏. qsort快速排序函数是C语⾔的⾼阶函数,⽀持⽤于⾃定义排序⽐较函数,可以对任意类型的数组进⾏排序. ...

  7. Ribbit Mq 实现延迟消息

    --------------------好记性不如烂笔头--------------------------- windows 环境,使用 rabbit Mq 需要安装, erl   和  rabbi ...

  8. Ajax同步和异步的区别,如何解决跨域的问题

    同步的概念应该是来自于OS中关于同步的概念:不同进程为协同完成某项工作而在先后次序上调整(通过阻塞,唤醒等方式),同步强调的是顺序性,谁先谁后,异步则不存在这种顺序性. 同步:浏览器访问服务器请求,用 ...

  9. GraalVM & Spring Boot初体验

    前言 这两天封在家里,一直在琢磨想去把这个博客项目改成微服务的形式.不过就目前而言我的服务器内存放好几个Java进程是吃不消的,原因在于一个独立的JVM所占用的内存资源太吃内存.不过在云原生时代,使用 ...

  10. 严重 [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.core.StandardContext.listenerStart Error configuring application listener of class com.titan.extend.SpringContextLoaderListener

    08-Jun-2022 10:05:21.119 严重 [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.core.StandardConte ...