Keras error: expected dense_input_1 to have 3 dimensions
The problem lies here:
model.add(Dense(32, input_shape=(5, 3)))
it should be:
model.add(Dense(32, input_shape=(3,)))
This first example dimension is not included in input_shape
. Also because it's actually dependent on batch_size
set during network fitting. If you want to specify you could try:
model.add(Dense(32, batch_input_shape=(5, 3)))
EDIT:
From your comment I understood that you want your input to have shape=(5,3)
in this case you need to:
reshape
yourx
by setting:x = x.reshape((1, 5, 3))
where first dimension comes from examples.
You need to
flatten
your model at some stage. It's because without it you'll be passing a2d
input through your network. I advice you to do the following:model = Sequential() model.add(Dense(32, input_shape=(5, 3))) model.add(Activation('relu')) model.add(Dense(32)) model.add(Activation('relu')) model.add(Flatten()) model.add(Dense(4))