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

查看:113
本文介绍了使用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是否真正成立,但看起来您正在推动整个测试集进行评估,即10 000张图像.即使对于中等大小的神经网络,它也很多.该过程很可能因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天全站免登陆