Page still in preparation, these are just experiments with sequences.
import numpy as np
input_data = np.arange(50)
input_data.reshape(10, 5)
array([[ 0, 1, 2, 3, 4],
[ 5, 6, 7, 8, 9],
[10, 11, 12, 13, 14],
[15, 16, 17, 18, 19],
[20, 21, 22, 23, 24],
[25, 26, 27, 28, 29],
[30, 31, 32, 33, 34],
[35, 36, 37, 38, 39],
[40, 41, 42, 43, 44],
[45, 46, 47, 48, 49]])
batch_size = 10
sequence_length = 5
for i in range(len(input_data)):
start = i
end = sequence_length + i
vec = input_data[start:end]
print(vec)
[0 1 2 3 4]
[1 2 3 4 5]
[2 3 4 5 6]
[3 4 5 6 7]
[4 5 6 7 8]
[5 6 7 8 9]
[ 6 7 8 9 10]
[ 7 8 9 10 11]
[ 8 9 10 11 12]
[ 9 10 11 12 13]
[10 11 12 13 14]
[11 12 13 14 15]
[12 13 14 15 16]
[13 14 15 16 17]
[14 15 16 17 18]
[15 16 17 18 19]
[16 17 18 19 20]
[17 18 19 20 21]
[18 19 20 21 22]
[19 20 21 22 23]
[20 21 22 23 24]
[21 22 23 24 25]
[22 23 24 25 26]
[23 24 25 26 27]
[24 25 26 27 28]
[25 26 27 28 29]
[26 27 28 29 30]
[27 28 29 30 31]
[28 29 30 31 32]
[29 30 31 32 33]
[30 31 32 33 34]
[31 32 33 34 35]
[32 33 34 35 36]
[33 34 35 36 37]
[34 35 36 37 38]
[35 36 37 38 39]
[36 37 38 39 40]
[37 38 39 40 41]
[38 39 40 41 42]
[39 40 41 42 43]
[40 41 42 43 44]
[41 42 43 44 45]
[42 43 44 45 46]
[43 44 45 46 47]
[44 45 46 47 48]
[45 46 47 48 49]
[46 47 48 49]
[47 48 49]
[48 49]
[49]
source:
https://machinelearningmastery.com/reshape-input-data-long-short-term-memory-networks-keras/