title: Keras LSTM autoencoder with embedding layer
body: <p>I am trying to build a text LSTM autoencoder in Keras. I want to use an embedding layer but I'am not sure how to implement this. The code looks like this.</p>
  
  <pre><code>inputs = Input(shape=(timesteps, input_dim))
  embedding_layer = Embedding(numfeats + 1,
                              EMBEDDING_DIM,
                              weights=[data_gen.get_embedding_matrix()],
                              input_length=maxlen,
                              trainable=False)
  
  embedded_sequence = embedding_layer(inputs)
  encoded = LSTM(num_units)(inputs)
  
  decoded = RepeatVector(timesteps)(encoded)
  decoded = LSTM(???, return_sequences=True)(decoded)
  
  sequence_autoencoder = Model(inputs, decoded)
  
  sequence_autoencoder.compile(loss='binary_crossentropy', optimizer='adam')
  </code></pre>
  
  <p>I am not sure how to decode the output into the target sequence (which is obviously the input sequence).</p>