2017-08-14 121 views
0

我从Keras收到此错误数组:ValueError异常:错误检查时输入:预计dense_6_input有3个维度,但得到了与形状

ValueError: Error when checking input: expected dense_6_input to have 3 dimensions,  but got array with shape (55, 72) 

model.fit(X.values, Y.values, nb_epoch=1000, batch_size=16,verbose=0) 

这是我的代码:

from keras.models import Sequential 
    from keras.layers import Dense, Activation 

model = Sequential([ 
    Dense(32, input_shape=X.values.shape), 
    Activation('relu'), 
    Dense(10), 
    Activation('softmax'), 
]) 
model.compile(loss='mse', optimizer='rmsprop') 
model.fit(X.values, Y.values, nb_epoch=1000, batch_size=16,verbose=0) 

X具有(55,72)

的形状

我该如何解决这个问题,以及dense_6_input是什么?

回答

0

问题是这里:

Dense(32, input_shape=X.values.shape) 

不要设置只是输入的形状值阵列input_shape,作为input_shape不包含样本尺寸。你想要的应该是:

Dense(32, input_shape=(72,)), 

然后,你应该能够称呼没有问题。

相关问题