How to write a LSTM model with 3 dimensional X_train and Y_trains?

I have X_train and Y_train with [2160,24,3] dimensions. But when I try a simple LSTM like this:

model = Sequential()


It gives me this error message:

ValueError: Error when checking target: expected dropout_192 to have shape (24, 24) but got array with shape (24, 3)

And when I try to change my code like this:

model = Sequential()



I get:

ValueError: Error when checking target: expected repeat_vector_55 to have shape (24, 24) but got array with shape (24, 3)

Also:

model = Sequential()


Or:

model = Sequential()


Gives me:

ValueError: Error when checking target: expected time_distributed_56 to have shape (24, 1) but got array with shape (24, 3)

I am confused and don't know how to fix it? What I want is train a LSTM model with X_train and Y_train of size [2160,24,3]. How can I do that?

model = Sequential()

• Thank you SaTa, it worked, but a new problem arrived! When I try model.predict(X_test) that X_test has a [6,24,3] shape, I get a [432,1] shape result, but I expected a shape as same as the X_test for my result. So how can I fix it? – user3486308 Jul 6 '19 at 13:56
• Yes, I changed the Dense layer's input to 3, then used that code but got predicted result in a [432,1] array instead of [6,24,3]. – user3486308 Jul 6 '19 at 16:13