我一直在运行一个位于这里的程序:https://github.com/dennybritz/cnn-text-classification-tf和基本代码可以很好地处理发布的示例。但是,我尝试将新的数据分割成一个火车/测试分割,然后它会给我带来错误。程序对我给出的火车数据进行训练,但到了评估时间,我得到了以下错误:
回溯(最近一次调用):
File "./eval.py", line 81, in correct_predictions = float(sum(all_predictions == y_test))
TypeError: 'bool' object is not iterable`在这个循环中问题所在的eval.py代码中:
for x_test_batch in batches:
batch_predictions = sess.run(predictions, {input_x: x_test_batch, dropout_keep_prob: 1.0})
all_predictions = np.concatenate([all_predictions, batch_predictions])其中,sess.run不返回任何内容,而batch_predictions成为一个空数组,随后导致一个值错误。还注意到:
我向github的所有者提出了这个问题,但他建议我通过执行跟踪。这是我第一次使用Tensorflow,我无法访问他们的网站。如果有人可以
或
我会无限感激的。感谢读过这篇文章的人!
发布于 2016-06-30 12:30:05
你说sess.run不返回任何东西,也许你可以在运行sess.run之前打印x_test_batch,看看里面是什么,也许它是空的,这不是你想要的。
https://stackoverflow.com/questions/38122715
复制相似问题