[英]ValueError: Error when checking input: expected dense_6_input to have 3 dimensions, but got array with shape
I'm receiving this error from Keras: 我从Keras收到此错误:
ValueError: Error when checking input: expected dense_6_input to have 3 dimensions, but got array with shape (55, 72)
on 上
model.fit(X.values, Y.values, nb_epoch=1000, batch_size=16,verbose=0)
This is my code: 这是我的代码:
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 has a shape of (55, 72) X的形状为(55,72)
How can I fix this and what is dense_6_input? 我该如何解决?什么是density_6_input?
The problem is here: 问题在这里:
Dense(32, input_shape=X.values.shape)
Don't set the input_shape to just the shape of the input values array, as the input_shape does not contain the samples dimension. 不要将input_shape设置为仅输入值数组的形状,因为input_shape不包含样本尺寸。 What you want should be:
您想要的应该是:
Dense(32, input_shape=(72,)),
Then you should be able to call fit without issues. 然后,您应该可以毫无问题地进行健身。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.