title: Multivariate input for LSTM in tensorflow
body: <p>I'm facing some doubts trying to implement LSTM with multiple input sequences (multivariate) under Tensorflow.</p>
  
  <p>I defined the LSTM in this way:</p>
  
  <pre><code>def LSTM(x):
  x = tf.reshape(x, [-1, input_length])
  x = tf.split(x, input_length, 1)
  
  rnn_cell = rnn.MultiRNNCell([rnn.BasicLSTMCell(n_hidden), rnn.BasicLSTMCell(n_hidden)])
  outputs, states = rnn.static_rnn(rnn_cell, x, dtype=tf.float32)
  return tf.matmul(outputs[-1], weights['out']) + biases['out']
  </code></pre>
  
  <p>and the data tensors are defined in this way:</p>
  
  <pre><code># tf Graph input
  X = tf.placeholder("float", [None, input_length, 1])
  Y = tf.placeholder("float", [None, n_classes])
  </code></pre>
  
  <p>which is ok for a one dimensional input with a known length. I will give you an easy example:
  You have the rain rate measured every second, so you have a time series of size N. You want to forecast the rain rate 30 minutes in advance so you split the data into segments every 30 minutes. So you would feed the LSTM with an input of 30(minutes)*60(one per second) measurements, and the output would be the rain rate after 30 minutes from the last given input (one measurement).</p>
  
  <p>Up to here, the problem is solved with this simple model, but what should I do to add another input? That would be, instead of using only the rain rate to forecast itself after 30 minutes, also feed the LSTM with, for example, the humidity rate and the wind speed every second. That would be an LSTM with 3 sequences as inputs, and each of those inputs would contain 30 minutes * 60 measurements. </p>
  
  <p>I need to add a "number_of_sequences" variable but I'm not sure how to reorganize the tensors. What should I change from my code? I'm a bit lost with the three dimensions of the X placeholder, maybe something like this?</p>
  
  <pre><code>X = tf.placeholder("float", [None, input_length, number_of_sequences])
  </code></pre>
  
  <p>And also with the code to transform the normal database into a sequence, maybe this?:</p>
  
  <pre><code>x = tf.reshape(x, [-1, input_length])
  x = tf.split(x, input_length, number_of_sequences)
  </code></pre>
  
  <p>Thank you in advance.</p>