使用 tensorflow 时 Python 内核死了 [英] Python kernel died when using tensorflow

查看:118
本文介绍了使用 tensorflow 时 Python 内核死了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Windows 7 操作系统的 anaconda 4.3.1(64 位)中的 python 3.5.2 下使用 tensorflow(仅限 CPU 版本).当我运行以下代码时,python内核死了,无法重启,出现一些错误但没有错误信息提示.

I am using tensorflow (CPU version only) under python 3.5.2 within anaconda 4.3.1 (64-bit) in Windows 7 Operation System. When I run the following code, the python kernel died and could not restart with some errors but no error information prompt.

print ("test accuracy %.3f" % accuracy.eval(feed_dict={  
    x: mnist.test.images, y_: mnist.test.labels, keep_prob: 1.0}))

但是当我运行类似的代码时,python 正常工作:

But when I run the similar codes, python works normally:

train_accuracy = accuracy.eval(feed_dict={  
    x:batch[0], y_: batch[1], keep_prob: 1.0}) 

什么原因会导致这个问题?

Which reason could cause this problem?

推荐答案

我不确定 mnist 是否真的成立,但看起来您正在推动整个测试集进行评估,即 10000 幅图像.即使对于中等规模的神经网络来说,这也很多.这个过程很可能会因 OOM 而死.

I'm not sure that mnist actually holds, but looks like you are pushing the whole test set for evaluation, which is 10 000 images. Even for a medium size neural network it's a lot. The process is likely to die with OOM.

尝试通过较小的批次,例如大小为 100.

Try to pass a smaller batch, say of size 100.

这篇关于使用 tensorflow 时 Python 内核死了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆