TensorFlow训练MNIST报错ResourceExhaustedError
2024-10-01 11:15:49
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))
最新文章
- python 2.7 学习笔记--文件的基本操作
- Javascript模块化编程(三):require.js的用法(转)
- C# 闭包
- socket编程中服务器端常用函数 以及简单实现
- Apache 反向代理实现为http添加https的外衣
- MySQL-procedure(cursor,loop)
- ndk学习17: jni之Java调用C&C++
- Linux学习笔记——使用指定的用户权限执行程序——sudo
- Excel 计算 tips
- 【转】个人对JQuery Proxy()函数的理解
- [转]JavaSE 8—新的时间和日期API
- [vijos P1595] 学校网络
- 用git上传项目到github
- php常用的优化手段
- win10上使用Xshell通过ssh连接Linux
- unity组件路径自动生成
- 我的代码-test models
- Exception 和 Error 有什么区别么
- Java中对数组的操作
- SQLite中的SELECT子句使用别名