title: TensorFlow 1.2 How to Setup Time Series Prediction at Inference Time Using Seq2Seq
body: <p>I am trying to study the tf.contrib.seq2seq section of the TensorFlow library using a toy model. Currently, my graph is as follows: </p>
  
  <pre><code>tf.reset_default_graph()
  
  # Placeholders
  enc_inp = tf.placeholder(tf.float32, [None, n_steps, n_input])
  expect = tf.placeholder(tf.float32, [None, n_steps, n_output])
  expect_length = tf.placeholder(tf.int32, [None])
  keep_prob = tf.placeholder(tf.float32, [])
  
  # Encoder
  cells = [tf.contrib.rnn.DropoutWrapper(tf.contrib.rnn.BasicLSTMCell(n_hidden), output_keep_prob=keep_prob) for i in range(layers_stacked_count)]
  cell = tf.contrib.rnn.MultiRNNCell(cells)
  encoded_outputs, encoded_states = tf.nn.dynamic_rnn(cell, enc_inp, dtype=tf.float32)
  
  # Decoder
  de_cells = [tf.contrib.rnn.DropoutWrapper(tf.contrib.rnn.BasicLSTMCell(n_hidden), output_keep_prob=keep_prob) for i in range(layers_stacked_count)]
  de_cell = tf.contrib.rnn.MultiRNNCell(de_cells)
  
  training_helper = tf.contrib.seq2seq.TrainingHelper(expect, expect_length)
  
  decoder = tf.contrib.seq2seq.BasicDecoder(cell=de_cell, helper=training_helper, initial_state=encoded_states)
  final_outputs, final_state, final_sequence_lengths = tf.contrib.seq2seq.dynamic_decode(decoder)
  
  decoder_logits = final_outputs.rnn_output
  
  h = tf.contrib.layers.fully_connected(decoder_logits, n_output)
  
  diff = tf.squared_difference(h, expect)
  batch_loss = tf.reduce_sum(diff, axis=1)
  loss = tf.reduce_mean(batch_loss)
  
  optimiser = tf.train.AdamOptimizer(1e-3)
  training_op = optimiser.minimize(loss)
  </code></pre>
  
  <p>The graph trains very well and executes fine. However, I am not sure what to do at inference time, since this graph always requires the <code>expect</code> variable (the value which I am trying to predict). </p>
  
  <p>As I understand, the TrainingHelper function is using the ground truth as input, so what I need is another helper function at inference time. </p>
  
  <p>Most implementations of seq2seq model I've seem appears to be outdated (tf.contrib.legacy_seq2seq). Some of the most up-to-date models often use GreddyEmbeddingHelper, which I'm not sure is appropriate for continuous time series predictions.</p>
  
  <p>Another possible solution I've found is to use the CustomHelper function. However, there is no little material out there for me to learn and I've just kept banging my head against the wall. </p>
  
  <p><strong>If I am trying to implement a seq2seq model for time series prediction, what should I do at inference time?</strong> </p>
  
  <p>Any help or advice would be greatly appreciated. Thanks in advance!</p>