Quantcast
Channel: Kaltura - Latest posts
Viewing all articles
Browse latest Browse all 7410

Exception existing connection is forcibly closed using python

$
0
0

You are getting this error because you did not specify any inputs to your model, and Keras is trying to set them on calling model.fit() . The assertion is there because each model wrapped in a Sequential container should take only one input.

To implement what you want, you probably want to go for Keras’ Python Functional API instead of the Sequential API. Something along these lines:

from keras.models import Model
from keras.layers import Concatenate, Input, Dense

# First model
first_input = Input((2, ))
first_dense = Dense(128)(first_input)

# Second model
second_input = Input((10, ))
second_dense = Dense(64)(second_input)

# Concatenate both
merged = Concatenate()([first_dense, second_dense])
output_layer = Dense(1)(merged)

model = Model(inputs=[first_input, second_input], outputs=output_layer)
model.compile(optimizer='sgd', loss='mse')

Viewing all articles
Browse latest Browse all 7410

Trending Articles