title: Split trained autoencoder to encoder and decoder
body: <p>I realize now that implementing it like <a href="https://stackoverflow.com/a/54931203/386738">this</a> would have been a good idea. However, I have an already trained and fine-tuned autoencoder that looks like this:</p>
  <pre><code>Model: &quot;autoencoder&quot;
  _________________________________________________________________
  Layer (type)                 Output Shape              Param #   
  =================================================================
  user_input (InputLayer)      [(None, 5999)]            0         
  _________________________________________________________________
  user_e00 (Dense)             (None, 64)                384000    
  _________________________________________________________________
  user_e01 (Dense)             (None, 64)                4160      
  _________________________________________________________________
  user_e02 (Dense)             (None, 64)                4160      
  _________________________________________________________________
  user_e03 (Dense)             (None, 64)                4160      
  _________________________________________________________________
  user_out (Dense)             (None, 32)                2080      
  _________________________________________________________________
  emb_dropout (Dropout)        (None, 32)                0         
  _________________________________________________________________
  user_d00 (Dense)             (None, 64)                2112      
  _________________________________________________________________
  user_d01 (Dense)             (None, 64)                4160      
  _________________________________________________________________
  user_d02 (Dense)             (None, 64)                4160      
  _________________________________________________________________
  user_d03 (Dense)             (None, 64)                4160      
  _________________________________________________________________
  user_res (Dense)             (None, 5999)              389935    
  =================================================================
  Total params: 803,087
  Trainable params: 0
  Non-trainable params: 803,087
  _________________________________________________________________
  </code></pre>
  <p>Now I want to split it into encoder and decoder. I believe I already found the right way for the encoder, which would be:</p>
  <pre><code>encoder_in = model.input
  encoder_out = model.get_layer(name='user_out').output
  encoder = Model(encoder_in, encoder_out, name='encoder')
  </code></pre>
  <p>For the decoder I would like to do something like:</p>
  <pre><code>decoder_in = model.get_layer(&quot;user_d00&quot;).input
  decoder_out = model.output
  decoder = Model(decoder_in, decoder_out, name='decoder')
  </code></pre>
  <p>but that throws:</p>
  <pre><code>WARNING:tensorflow:Functional inputs must come from `tf.keras.Input` (thus holding past layer metadata), they cannot be the output of a previous non-Input layer. Here, a tensor specified as input to &quot;decoder&quot; was not an Input tensor, it was generated by layer emb_dropout.
  Note that input tensors are instantiated via `tensor = tf.keras.Input(shape)`.
  The tensor that caused the issue was: emb_dropout/cond_3/Identity:0 
  </code></pre>
  <p>I believe I have to create an <code>Input</code> layer with the shape of the output of <code>emb_dropout</code> and probably add it to <code>user_d00</code> (since the Dropout layer is not needed anymore since training has ended). Anyone knows how to do it correctly?</p>