我目前正在构建一个三层DNN来解决泰坦尼克号数据集问题。在构建模型时,我收到以下错误:
targets[3] is out of range
我的代码可以通过我的github帐户访问:https://github.com/isaac-altair/Titanic-Dataset/blob/master/Titanic%2BProject.ipynb
谢谢
答案 0 :(得分:0)
根据documentation tf.nn.in_top_k
预期类型float32
的张量为batch_size x classes
。在您的情况下,您有2个类,因此predictions
张量应该具有形状batch_size x 2
。