I have a numpy array A
of shape (550,10)
. I have batch size of 100 i.e how much data rows I want from A
. In each iteration I want to extract 100 rows from A. But when I reach last 50 rows, I want last 50 and first 50 rows from A.
I have a function like this:
def train(index, batch_size):
if(batch_size + index < A.shape(0)):
data_end_index = index + batch_size
batch_data = A[index:batch_end_index,:]
else:
data_end_index = index + batch_size - A.shape(0) #550+100-600 = 50
batch_data = A[500 to 549 and 0 to 49] # How to slice here ?
How to perform last step ?