Can't load merge layer when using Keras_core

Skip to first unread message

Stefan Caldararu

Aug 7, 2023, 8:42:32 AM8/7/23
to Keras-users
Hello all,

I am rather new to using Keras - sorry if this is a bad model design, or my issue is an easy fix.

I am using Keras_core, with torch as the backend. I am trying to concatenate two layers, which each have 2 outputs. I get no errors when training this model, and am able to save it. But, when I try to load it in a different python program, I get the following error: ValueError: A merge layer should be called on a list of inputs. Received: input_shape=[[None, 2], [None, 2]] (not a list of shapes). When I try to train and load the same model structure, trained on the same data with standard Keras from TensorFlow, I get no errors. If anyone has any insight into why this is happening that would be greatly appreciated!

If more background is needed, here is the general structure I am trying to implement:

I want the final model to take as input 4 values, and output 2 values from this: output1 and output2. I have 2 datasets, one which has good values for output1, but bad for output2, and another which has good values for output2, but bad values for output1. I want my model to be structured as follows:

Input layer of 4 values feeds into 2 branches with a series of dense layers. Final output of each branch is 2 values. I then concatenate these 2 branches into 4 total values, and feed this through another set of Dense layers to get my final 2 outputs. Goal would be to set one branch as trainable at a time, and train based on each of the datasets, so that branch1 performs well on output1 and branch2 performs well on output2. Then, train the final merged section based on a third set of data, which performs well on both outputs but doesn't have much training data.

Any help would be amazing!!

Francois Chollet

Aug 7, 2023, 12:20:04 PM8/7/23
to Stefan Caldararu, Keras-users
Please open a GitHub issue on the keras-core repo with a code snippet to reproduce your issue.

You received this message because you are subscribed to the Google Groups "Keras-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit
Reply all
Reply to author
0 new messages