I want to get n rows from x_train and y_train in for loop using zip() each time. So the code below is what i have tried to do.At each iteration i update prev batch and next batch so i will get [0-5],[5-10],... rows from both 2d numpy arrays.
batch_size = 3
next_b = batch_size
prev_b = 0
//sample input
x_train = [ [0,1,2],[3,4,5],[6,7,8],[9,10,11],[12,13,14] ]
y_train = [ [3],[6],[9],[12],[15] ]
for X,y in zip(x_train,y_train)[prev_b:next_b]:
print(X,y)
//prev_b = 0, next_b = 3, so i want to get below values at first iter
//X => [[0,1,2],[3,4,5],[6,7,8]]
//y => [ [3],[6],[9] ]
prev_b = next_b //-> prev_b = 3, for the next iteration
next_b += batch_size //-> next_b = 6, for the next iteration
Any help is welcome.