I am trying to concatenate two layers by using Keras and TensorFlow.I keep getting the error at the concatenate line. I have tried other suggestions from similar questions but it keeps giving the same error. I feel that I'm doing some mistakes but I can't figure it out. can anyone explain this?
model1=Sequential()
model1.add(LSTM(150,return_sequences=True,input_shape=(win_length,num_features), activation='relu'))
model1.add(LSTM(100, return_sequences=False))
model1.add(BatchNormalization())
model2=Sequential()
model2.add(GRU(150, return_sequences=True, input_shape=(win_length,num_features), activation='relu' ))
model2.add(GRU(100, return_sequences=False))
model2.add(BatchNormalization())
merged_model = Sequential()
merged_model.add(Concatenate([model1, model2]))
merged_model.add(Dense(300))
merged_model.add(PReLU())
merged_model.add(Dropout(0.2))
#merged_model.summary()
merged_model.compile(loss='mse', optimizer='adam')
merged_model.fit(train_generator, epochs=50, batch_size=32)
this is the error:
ValueError: Exception encountered when calling layer "sequential_114" (type Sequential).
A `Concatenate` layer should be called on a list of at least 1 input. Received: input_shape=(32, 10, 4)
Call arguments received:
• inputs=tf.Tensor(shape=(32, 10, 4), dtype=float32)
• training=False
• mask=None
I feel there are some updates in Keras, that are not letting two different models concatenate properly.