def batch_generator_old(data, target, BATCH_SIZE, shuffle=False):
 np.random.seed()
 idx = np.arange(data.shape[0])
 if shuffle:
  np.random.shuffle(idx)
 idx_2 = np.array(idx)
 while (BATCH_SIZE > len(idx)):
  idx_2 = np.concatenate((idx_2, idx))
 del idx
 while True:
  ctr = 0
  (yield (np.array(data[idx_2[ctr:(ctr + BATCH_SIZE)]]), np.array(target[idx_2[ctr:(ctr + BATCH_SIZE)]])))
  ctr += BATCH_SIZE
  if (ctr >= data.shape[0]):
   ctr -= data.shape[0]

def batch_generator_old ( data , target , BATCH_SIZE , shuffle = False ) : np . random . seed ( ) idx = np . arange ( data . shape [ 0 ] ) if shuffle : np . random . shuffle ( idx ) idx_2 = np . array ( idx ) while ( BATCH_SIZE > len ( idx ) ) : idx_2 = np . concatenate ( ( idx_2 , idx ) ) del idx while True : ctr = 0 ( yield ( np . array ( data [ idx_2 [ ctr : ( ctr + BATCH_SIZE ) ] ] ) , np . array ( target [ idx_2 [ ctr : ( ctr + BATCH_SIZE ) ] ] ) ) ) ctr += BATCH_SIZE if ( ctr >= data . shape [ 0 ] ) : ctr -= data . shape [ 0 ]
just a simple batch iterator .