DNN,目标[3]超出范围误差

时间:2018-05-03 02:47:16

标签: python tensorflow kaggle

我目前正在构建一个三层DNN来解决泰坦尼克号数据集问题。在构建模型时,我收到以下错误:

targets[3] is out of range

我的代码可以通过我的github帐户访问:https://github.com/isaac-altair/Titanic-Dataset/blob/master/Titanic%2BProject.ipynb

谢谢

1 个答案:

答案 0 :(得分:0)

根据documentation tf.nn.in_top_k预期类型float32的张量为batch_size x classes。在您的情况下,您有2个类,因此predictions张量应该具有形状batch_size x 2