Your sequence should be ordered [x(t-N) ... x(t-1), x(t)]. Keep in mind that the sequence dimension should be first unless you specify batch_first=True on the LSTM layer. Your X and Y variables should be shaped [T,N,C] where T is the sequence length, N, is the batch size, and C is the feature size.