title: TensorFlow训练MNIST报错ResourceExhaustedError

date: 2018-04-01 12:35:44

categories:

  • deep learning

tags:

  • MNIST
  • TensorFlow

在最后测试的一步报错:

ResourceExhaustedError (see above for traceback): OOM when allocating tensor

搜索了一下才知道是GPU显存不足(emmmm....)造成的,可以把最后测试的那行代码改为将测试集分成几个小部分分别测试最后再求精度的平均值:

accuracy_sum = tf.reduce_sum(tf.cast(correct_prediction, tf.float32))
good = 0
total = 0
for i in range(10):
testSet = mnist.test.next_batch(50)
good += accuracy_sum.eval(feed_dict={ x: testSet[0], y_: testSet[1], keep_prob: 1.0})
total += testSet[0].shape[0]
print ("test accuracy %g"%(good/total))

TensorFlow训练MNIST报错ResourceExhaustedError的更多相关文章

  1. tensorflow 训练cifar10报错

    1.AttributeError: 'module' object has noattribute 'random_crop' 解决方案: 将distorted_image= tf.image.ran ...

  2. Tensorflow运行程序报错 FailedPreconditionError

    1 FailedPreconditionError错误现象 在运行tensorflow时出现报错,报错语句如下: FailedPreconditionError (see above for trac ...

  3. 2、TensorFlow训练MNIST

    装载自:http://www.tensorfly.cn/tfdoc/tutorials/mnist_beginners.html TensorFlow训练MNIST 这个教程的目标读者是对机器学习和T ...

  4. TensorFlow学习笔记(MNIST报错修正 适用Tensorflow1.3)

    在Tensorflow实战Google框架下的深度学习这本书的MNIST的图像识别例子中,每次都要报错   错误如下: Only call `sparse_softmax_cross_entropy_ ...

  5. TensorFlow 训练MNIST数据集(2)—— 多层神经网络

    在我的上一篇随笔中,采用了单层神经网络来对MNIST进行训练,在测试集中只有约90%的正确率.这次换一种神经网络(多层神经网络)来进行训练和测试. 1.获取MNIST数据 MNIST数据集只要一行代码 ...

  6. keras 或 tensorflow 调用GPU报错:Blas GEMM launch failed

    GPU版的tensorflow在模型训练时遇到Blas GEMM launch failed错误,或者keras遇到相同错误(keras 一般将tensorflow作为backend,如果安装了GPU ...

  7. TensorFlow训练MNIST数据集(3) —— 卷积神经网络

    前面两篇随笔实现的单层神经网络 和多层神经网络, 在MNIST测试集上的正确率分别约为90%和96%.在换用多层神经网络后,正确率已有很大的提升.这次将采用卷积神经网络继续进行测试. 1.模型基本结构 ...

  8. TensorFlow训练MNIST数据集(1) —— softmax 单层神经网络

    1.MNIST数据集简介 首先通过下面两行代码获取到TensorFlow内置的MNIST数据集: from tensorflow.examples.tutorials.mnist import inp ...

  9. 服务器安装tensorflow导入模块报错Illegal instruction (core dumped)

    在ubuntu上安装tensorflow后导入模块显示Illegal instruction (core dumped) 服务器的版本是Ubuntu 16.04.5 降低版本,成功导入模块 pip3 ...

随机推荐

  1. Vue.js 2.x Development Build With Hot Reloading For External Server (using Webpack template)

    This article assuming you created your project using webpack template. vue init webpack <PROJECT_ ...

  2. Android7.0打开sdacrd图片问题

    1.点击item,通过intent打开指定路径的图片. 2.测试6.0,5.0正常运行代码: File file=new File(item.address): Intent intent = new ...

  3. IntelliJ Idea使用代码折叠

    VS风格: //region    xxxxxxxxxxxxxx ............. //endregion 快捷键: Ctrl+Shift+”+/-”,全部展开.折叠

  4. 《鸟哥的Linux私房菜》笔记——04. 简单命令行

    键入命令 [dmtsai@study ~]$ command [-options] parameter1 parameter2 ... 指令 選項 參數(1) 參數(2) 注意:有时也可以使用 + 放 ...

  5. Mac Technology Overview

    [Mac Technology Overview]https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual ...

  6. luogu p1003

    P1003 题意 经过多个矩形(1e3)覆盖后后某个坐标属于那个矩形(仅仅是一次询问) 大水题,直接的做法,从后向前处理矩形是否覆盖查询的点,若覆盖,则是该矩形编号 题解 int get_num(){ ...

  7. Proxifier安装与使用

    Proxifier安装与使用 1.Proxifier官网可能打不开,这是一个下载地址,提取码为p1l8. 用户名随意填 注册码下边 5EZ8G-C3WL5-B56YG-SCXM9-6QZAP G3ZC ...

  8. centos7下部署Redis

    1.1. Redis的安装 Redis是c语言开发的. 安装redis需要c语言的编译环境.如果没有gcc需要在线安装.yum install gcc-c++ 安装步骤: 第一步:redis的源码包上 ...

  9. mybatis中sql标签和include标签

    1.首先定义一个sql标签,一定要定义唯一id.(name,age是要查询的字段) <sql id="Base_Column_List" >name,age</s ...

  10. 【 henuacm2016级暑期训练-动态规划专题 A 】Cards

    [链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 很显然只要维护B,R,G的数量就好了. 可以很容易想到一个dfs(int a,int b,int c) 然后如果a+b+c==1,那 ...