title: Reshaping Numpy array repeating some elements
body: <p>I have trained a NN in Keras with LSTM, so I have been using 3D tensors. Now I want to predict with a dataset and I have to insert a 3D tensor in my NN. </p>
  
  <p>(In my case I used <code>features = 2</code> and <code>lookback = 2</code>, so input elements in LSTM are <code>(batch_size, lookback, features)</code>)</p>
  
  <p>So, imagine this example:</p>
  
  <pre><code>a = np.array([[1, 2],
                [3, 4]])
  </code></pre>
  
  <p>I need to do <code>a_2 = np.reshape(1, 2, 2)</code> to be able to insert it in the LSTM.</p>
  
  <p>But if I have a bigger test dataset, like for instance:</p>
  
  <pre><code>b = np.array([[1, 2],
                [3, 4],
                [5, 6],
                [7, 8],
                [9, 10]])
  </code></pre>
  
  <p>I would need to convert it to a 3D array of this type:</p>
  
  <pre><code>b_2 = np.array([[[1, 2],
                   [3, 4]],
  
                  [[3, 4],
                   [5, 6]],
  
                  [[5, 6],
                   [7, 8]],
  
                  [[7, 8],
                   [9, 10]]])
  </code></pre>
  
  <p>so in this case I have predictions for each <code>lookback</code> with the new point. I guess this could be done with a complicated solution using many <code>for</code> loops nested, but I wonder if there is more pythonic way. Thx.</p>