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?
-
$\begingroup$ Yes, this is possible with Keras. See this file > github.com/shubham0204/Melanoma_Classification_with_TF/blob/… $\endgroup$ – Shubham Panchal May 8 '19 at 1:54
$\begingroup$
$\endgroup$
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)