title: Specifying a seq2seq autoencoder. What does RepeatVector do? And what is the effect of batch learning on predicting output?
body: <p>I am building a basic seq2seq autoencoder, but I'm not sure if I'm doing it correctly. </p>
  
  <pre><code>model = Sequential()
  # Encoder       
  model.add(LSTM(32, activation='relu', input_shape =(timesteps, n_features ), return_sequences=True))
  model.add(LSTM(16, activation='relu', return_sequences=False))
  model.add(RepeatVector(timesteps))
  # Decoder
  model.add(LSTM(16, activation='relu', return_sequences=True))
  model.add(LSTM(32, activation='relu', return_sequences=True))
  model.add(TimeDistributed(Dense(n_features)))'''
  </code></pre>
  
  <p>The model is then fit using a batch size parameter</p>
  
  <pre><code>model.fit(data, data,       
            epochs=30, 
            batch_size = 32)
  </code></pre>
  
  <p>The model is compiled with the <code>mse</code> loss function and seems to learn. </p>
  
  <p>To get the encoder output for the test data, I am using a K function:</p>
  
  <pre><code>get_encoder_output = K.function([model.layers[0].input],
                                    [model.layers[1].output])
  
  encoder_output = get_encoder_output([test_data])[0]
  </code></pre>
  
  <p>My first question is whether the model is specified correctly. In particular whether the RepeatVector layer is needed. I'm not sure what it is doing. What if I omit it and specify the preceding layer with <code>return_sequences = True</code>?</p>
  
  <p>My second question is whether I need to tell <code>get_encoder_output</code> about the <code>batch_size</code> used in training?</p>
  
  <p>Thanks in advance for any help on either question.</p>