title: PyTorch: Dataloader for time series task
body: <p>I have a Pandas dataframe with <code>n</code> rows and <code>k</code> columns loaded into memory. I would like to get batches for a forecasting task where the first training example of a batch should have shape <code>(q, k)</code> with <code>q</code> referring to the number of rows from the original dataframe (e.g. 0:128). The next example should be <code>(128:256, k)</code> and so on. So, ultimately, one batch should have the shape <code>(32, q, k)</code> with 32 corresponding to the batch size.</p>
  <p>Since <code>TensorDataset</code> from <code>data_utils</code> does not work here, I am wondering what the best way would be. I tried to use <code>np.array_split()</code> to get as first dimension the number of possible splits of <em>q</em> values in order to write a custom DataLoader but then reshaping is not guaranteed to work since not all arrays have the same shape.</p>
  <p>Here is a minimal example to make it more clear. In this case, batch size is 3 and <em>q</em> is 2:</p>
  <pre><code>import pandas as pd
  import numpy as np
  df = pd.DataFrame(data=np.arange(0,30).reshape(10,3),columns=['A','B','C'])
  </code></pre>
  <p>The dataset:</p>
  <pre><code>    A   B   C
  0   0   1   2
  1   3   4   5
  2   6   7   8
  3   9   10  11
  4   12  13  14
  5   15  16  17
  6   18  19  20
  7   21  22  23
  8   24  25  26
  9   27  28  29
  </code></pre>
  <p>The first batch in this case should have the shape (3,2,3) and look like:</p>
  <pre><code>array([[[ 0.,  1.,  2.],
          [ 3.,  4.,  5.]],
  
         [[ 3.,  4.,  5.],
          [ 6.,  7.,  8.]],
  
         [[ 6.,  7.,  8.],
          [ 9., 10., 11.]]])
  </code></pre>