Hello!
I am trying to create a model that feeds input parallely to an LSTM and BLSTM layer, the output from which are then concatenated to feed another LSTM layer.
My input dimensions will be varying in the sense nx64 (Number of rows is not constant)
But when I try to fit the model, I get the following error:
Error when checking input: expected input_17 to have 3 dimensions, but got array with shape (6, 64)
What am I doing wrong? And how do I rectify it?
This is my code:
from keras.models import Model
from keras.layers import Concatenate, Dense, LSTM, Input, concatenate, Bidirectional
Hello! I am trying to create a model that feeds input parallely to an LSTM and BLSTM layer, the output from which are then concatenated to feed another LSTM layer. My input dimensions will be varying in the sense nx64 (Number of rows is not constant)
But when I try to fit the model, I get the following error: Error when checking input: expected input_17 to have 3 dimensions, but got array with shape (6, 64) What am I doing wrong? And how do I rectify it?
This is my code: from keras.models import Model from keras.layers import Concatenate, Dense, LSTM, Input, concatenate, Bidirectional
input_size = 64 hidden_units = 512 output_size = 62
first_input = Input(shape=(None, input_size)) first_LSTM = LSTM(hidden_units,return_sequences=True)(first_input)
first_BLSTM = Bidirectional(LSTM(hidden_units,return_sequences=True))(first_input)
merged_output = concatenate([first_LSTM, first_BLSTM])
second_LSTM = LSTM(hidden_units, return_sequences=True)(merged_output) model = Model(inputs = [first_input], outputs = second_LSTM)
model.compile('adam', 'binary_crossentropy', metrics=['accuracy'])
Thanks in advance!