# Why the RNN has input shape error?

My x_train shape is (798,3) and y_train input shape is (798, 1). I am creating a RNN like this

def create_rnn_model():
model = Sequential()

return model


But this returns the error

ValueError: Error when checking input: expected simple_rnn_1_input to have 3 dimensions, but got array with shape (798, 3)

My batch size =1 and my timestep is 3 and dat_dim=1 .Then where am I doing it wrong? Any help is appreciated.

EDIT

I changed my x_train to shape (798,3,1) and y_train shape to (798,) and ran the model but it threw an error

ValueError: Error when checking target: expected activation_1 to have shape (20,) but got array with shape (1,)


But I can run the model with 1 unit. How do I specify the model to run with 20 units instead of one.

• We don't even know what library you are using (and I assume this is python). I think you should provide a working code sample, and ask on stackoverflow (this is a programming question obviously). – debzsud Oct 23 '18 at 11:48
• Rather than a programming question my real question is whether am I correct feeding the input or how wrong I am from the model perspective – Ricky Oct 24 '18 at 4:32
• possible duplicate:-datascience.stackexchange.com/questions/32858/… – naive Oct 24 '18 at 5:13

Finally, your network returns output's shape of (20,) (RNN return (20,) and activation don't change shape) and you compare this with y_train with shape of (1,). Shapes dismatch so it return this error