Reputation: 1374
i'm currently trying to create a custom made CNN using the already trained VGG19 convolutional layers and then adding my own dense layers which i plan to train. the network has a question branch and an answer branch and ultimately has to decide if the answer has the same content as the question.
i'm getting:
AttributeError: 'Tensor' object has no attribute 'input'
here's the code:
initial_model = VGG19()
q_input = Model(initial_model.input, initial_model.layers[-layers_to_omit].output)
a_input = Model(initial_model.input, initial_model.layers[-layers_to_omit].output)
q_output = tf.keras.layers.Flatten()(q_input.output)
a_output = tf.keras.layers.Flatten()(a_input.output)
q_model = Model(initial_model.input, q_output)
a_model = Model(initial_model.input, a_output)
print(q_model.summary())
# combine the output of the two branches
combined = concatenate([q_model.output, a_model.output])
z = Dense(64, activation="relu")(combined)
z = Dense(32, activation="relu")(z)
z = Dense(64, activation="relu")(z)
z = Dense(1, activation="linear")(z)
# our model will accept the inputs of the two branches and
# then output a single value
model = Model(inputs=[q_model.input, a_output.input], outputs=z)
I saw some people had problems with Add but since i dont use it, i'm kinda lost.
Thanks for your help!
Upvotes: 0
Views: 214
Reputation: 11132
Changing a_output.input
to a_model.input
should fix that error.
Upvotes: 1