ValueError: y_i value out of bounds


用python theano的LeNet做人脸识别的时候,本来是按照手写输入的程序,改一下参数准备train,

然后发现出现错误,ValueError: y_i value out of bounds

感觉是cost_ij = train_model(minibatch_index)的问题

train_model = theano.function(

    [index],
    cost,
    updates=updates,
    givens={
        x: train_set_x[index * batch_size: (index + 1) * batch_size],
        y: train_set_y[index * batch_size: (index + 1) * batch_size]
    }
)

百度了半天,源代码看得晕乎乎的,

最后google了一下,

因为y的标签只能设置[0,n),而我标签设为[1,n]了~~改了一下就OK了


posted on 2016-12-08 20:59  mandalalala  阅读(193)  评论(0编辑  收藏  举报