I'm trying to merge two neural networks with Keras.
The code:
left_branch = Sequential()
left_branch.add(Dense(512, input_shape=(7000,)))
left_branch.add(Activation('relu'))
right_branch = Sequential()
right_branch.add(Dense(512, input_shape=(14012,)))
right_branch.add(Activation('relu'))
merged = Concatenate([left_branch, right_branch])
final_model = Sequential()
final_model.add(merged)
final_model.add(Dense(3, activation='softmax'))
final_model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['accuracy'])
final_model.fit([np.array(review_matrix), np.array(X_train)], labels,epochs=2, verbose=1)
final_model.save('model.merged')
I get the following error: AssertionError (assert len(inputs) == 1)
I guess the problem comes from the fact that final_model should not be sequential. However, I don't know how I can do otherwise. In a lot of links, it works with sequential model (for example: https://statcompute.wordpress.com/2017/01/08/an-example-of-merge-layer-in-keras/)
Thanks !