title: How to split an existing keras model into two separate models?
body: <p>I have a keras model (already trained) that I want to split to two parts (one part computes internal representation from the original inputs, and the other part computes the output from the precomputed internal representation)</p>
  
  <p>getting the 1st part is simple (input to internal representation)
  but the second part is problematic</p>
  
  <p>I found two related answers, but they are problematic in my case </p>
  
  <p>the methods described in these answers are:</p>
  
  <ol>
  <li><a href="https://stackoverflow.com/q/43349489/590335">How to split a model into two seperate models?</a></li>
  </ol>
  
  <p>in this solution you redefine the second part of the network - this appears feasible, but requires a significant amount of code duplication (the network is quite complex)</p>
  
  <ol start="2">
  <li><a href="https://stackoverflow.com/q/48603328/590335">How do I split an convolutional autoencoder?</a></li>
  </ol>
  
  <p>in this solution the model is defined by composition of two models - this looks like a good solution, but not relevant for an existing trained network</p>