Skip to content Skip to sidebar Skip to footer

Why Does This Error Happen In Keras,"graph Disconnected" When I Want To Separate Whole Network Into Two Models?

I have an autoencoder in keras and I need to define a different model for each part because my network has two outputs and I want to have two separate network for each output durin

Solution 1:

The problem is that decoded_noise is not an Input layer so you can't you it as input when defining your wext model. Instead, define a new input layer for your wext model:

#----------------------w extraction------------------------------------
# Here we define a new input to be used by the wext model
decoded_input = Input((28,28,1)) 
convw1 = Conv2D(64, (3,3), ...)(decoded_input)
convw2 = ...
...
pred_w = ...

wext=Model(inputs=decoded_input, outputs=pred_w)

# Final model: pass the gaussian noise through the wext model
decoded_noise = GaussianNoise(0.5)(decoded)
pred_w = wext(decoded_noise)

final=Model(inputs=[image, wtm], outputs=[decoded, pred_w])

Post a Comment for "Why Does This Error Happen In Keras,"graph Disconnected" When I Want To Separate Whole Network Into Two Models?"