Error: keras merge LSTM layers in sum mode I want to merge two sequential models in sum mode into one model using keras as:

left = Sequential()
left.add(LSTM(64,activation='sigmoid',stateful=True,batch_input_shape=(10,look_back,dim)))
right = Sequential()
right.add(LSTM(64,activation='sigmoid',stateful=True,batch_input_shape=(10,look_back,dim)))
model = Sequential()
model.add(Add()([left, right]))


But the statement model.add(Add()[left,right]) gives error: Layer add was called with an input that isn't a symbolic tensor. Received type: . Full input: [, ]. All inputs to the layer should be tensors.
The error says what's the problem: the method expects a Tensors, but you are giving a Sequential model object.

Use functional model (from keras.models import Model), not Sequential.

Then, merge the models with:

merged_models = Model(inputs=[first_model_input, second_model_input], outputs=[first_model_output, second_model_output])


or whatever your input looks like.