1
$\begingroup$

I am following the code below with all the libraries imported:

mergedOut = Add()([model1.output,model2.output])

mergedOut = Flatten()(mergedOut)    

mergedOut = Dense(256, activation='relu')(mergedOut)

mergedOut = Dropout(.5)(mergedOut)

mergedOut = Dense(128, activation='relu')(mergedOut)

mergedOut = Dropout(.35)(mergedOut)

# output layer

mergedOut = Dense(5, activation='softmax')(mergedOut)

newModel = Model([model1.input,model2.input], mergedOut)

newModel.compile(loss='sparse_categorical_crossentropy', optimizer='adam', metrics=['accuracy'])
newModel.fit(x_train, y_train, batch_size=100, epochs=5)

However, I am dealing with the following error everytime:

ValueError: Error when checking model input: the list of Numpy arrays that you are passing to your model is not the size the model expected. Expected to see 2 array(s), but instead got the following list of 1 arrays: [array([[[-0.36227286, -0.0600015 , -0.14906043, ..., -0.28826913, -0.16141416, -0.16673401]], [[-0.36227286, -0.05597525, -0.14903974, ..., -0.30347877, 0.11033272, 0.4293...

$\endgroup$