1 
         
 
         
             
         
 
 
 
 
             
 
             
 
     $begingroup$ 
     
 
 I have this LSTM model   model = Sequential()  model.add(Masking(mask_value=0, input_shape=(timesteps, features)))  model.add(LSTM(100, dropout=0.2, recurrent_dropout=0.2, return_sequences=False))  model.add(Dense(features, activation='softmax'))  model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['accuracy'])    and shapes X_train (21, 11, 5), y_train (21, 5) .   Each timestep is represented by 5 features and  return_sequences  is set to False  because I want to predict one 5D array (the next timestep) for each input sequence of 11 timesteps.   I get the error      ValueError: y_true and y_pred have different number of output (5!=1)    If I reshape the data as X_train (21, 11, 5), y_train (21, 1, 5)  instead I get the error      ValueError: Inva...