3

I am trying to build a CNN that receives multiple inputs and I am trying the following:

input = keras.Input()
classifier = keras.Model(inputs=input,output=classifier)

When run the code I am receiving the following error for line 6 though:

TypeError: ('Keyword argument not understood:', 'input').

A hint would be much appreciated, thank you!

1
  • 1
    Are you sure this is the code that produces the error? Which line triggers the error? I don't see any keyword argument called input here. Commented Aug 8, 2020 at 11:01

2 Answers 2

3

Some parameters of your code are not specified. I have copied your example with some numbers that you can change back.

import keras

input_dim_1 = 10
input1 = keras.layers.Input(shape=(input_dim_1,1))
cnn_classifier_1 = keras.layers.Conv1D(64, 5, activation='sigmoid')(input1)
cnn_classifier_1 = keras.layers.Dropout(0.5)(cnn_classifier_1)
cnn_classifier_1 = keras.layers.Conv1D(48, 5, activation='sigmoid')(cnn_classifier_1)
cnn_classifier_1 = keras.models.Model(inputs=input1,outputs=cnn_classifier_1)

Some things to note

  1. The imports of your layers were not right. You need to import the layers/models you want from the right places. You can check my code against yours to see this.
  2. With the functional API of keras you do not need to specify the input shape as you have done in the first Conv1D layer. This is handled automatically.
  3. You need to correctly specify the keywords in Model. Specifically inputs and outputs. Different versions of keras use input / output or inputs/outputs as keywords for the call of the class Model.
Sign up to request clarification or add additional context in comments.

Comments

2

Hey, its simple, use following code:

classifier = keras.Model(input, classifier)

instead of calling

classifier = keras.Model(inputs = input, output = classifier)

Issue seems to come from latest versions of keras implementation.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.