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))

最新文章

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

热门文章

  1. input file上传文件
  2. Django迁移到mysql数据库时的错误
  3. ROS常用知识指南
  4. Python爬虫:爬取某网站关键词对应商品ID,且存入DB2数据库
  5. Kattis - String Matching(kmp)
  6. ubantu上搭建hive环境
  7. AC Codeforces Round #499 (Div. 2) E. Border 扩展欧几里得
  8. Pyhton学习——Day46
  9. adb屏幕截屏
  10. APICloud资料