I am trying to build an architecture with multiple inputs in Keras. As mentioned in 1, I used similar code as followed:
model_merged = Model(inputs=[model_parts1, model_parts2,
model_parts3, model_parts4])
But I get the following error:
TypeError: _init_subclassed_network() got an unexpected keyword argument 'inputs'
I have searched online and some people mentioned that Keras should be updated to version 2.0.0; though I have version 2.2.2 installed which I suppose is not the problem.
Can anyone help me with this error?
The Sequential model API is a way of creating deep learning models where an instance of the Sequential class is created and model layers are created and added to it.
Keras functional api Model expects two positional arguments namely inputs
, and outputs
.
The error
TypeError: _init_subclassed_network() got an unexpected keyword argument 'inputs'
is thrown when the output of the model is not specified.
input1 = keras.layers.Input(shape=(8,))
input2 = keras.layers.Input(shape=(8,))
h1 = keras.layers.Concatenate()([input1, input2])
model = keras.models.Model(inputs=[input1, input2])
this throws the following error
TypeError: _init_subclassed_network() got an unexpected keyword argument 'inputs'
But if outputs are specified it works without error
model = keras.models.Model(inputs=[input1, input2], outputs=h1)
Similar exception is thrown when the outputs
argument is passed without inputs
argument.
model = keras.models.Model(outputs=h1)
TypeError: _init_subclassed_network() got an unexpected keyword argument 'outputs'
I think it would be very helpful, if the error message would have been more informative. The inputs
and outputs
arguments are "not unexpected" arguments here. It would be more informative if the error message would have been
TypeError: _init_subclassed_network() missing expected keyword argument 'outputs'
for the former case where only inputs
argument is specified and
TypeError: _init_subclassed_network() missing expected keyword argument 'inputs'
for the later case where there only outputs
argument is specified.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With