I'm trying to build a architecture that takes in multiple inputs and has a smaller neural network inside a larger architecture. For me to keep track of of the smaller netowrk's loss, I need to compile the sub-network as a Sequential, but it still needs to be part of the functional model as a whole for the architecture. Is this possible in Keras?


I managed to trial and error through this.

x = Sequential()
# add some layers...
inputs = [Input(...), Input(...), ...]
outputs = ... #some layers stacked together via the functional model
result = Model(inputs=inputs, x(outputs))

If you want the sequential in the middle of the outputs up there for some reason:

output1 = Layer(input)
output2 = x(layer1)
outputs = Layer(output2)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.