def minibatches(inputs=None, targets=None, batch_size=None, shuffle=False):
 assert (len(inputs) == len(targets))
 if shuffle:
  indices = np.arange(len(inputs))
  np.random.shuffle(indices)
 for start_idx in range(0, ((len(inputs) - batch_size) + 1), batch_size):
  if shuffle:
   excerpt = indices[start_idx:(start_idx + batch_size)]
  else:
   excerpt = slice(start_idx, (start_idx + batch_size))
  (yield (inputs[excerpt], targets[excerpt]))

def minibatches ( inputs = None , targets = None , batch_size = None , shuffle = False ) : assert ( len ( inputs ) == len ( targets ) ) if shuffle : indices = np . arange ( len ( inputs ) ) np . random . shuffle ( indices ) for start_idx in range ( 0 , ( ( len ( inputs ) - batch_size ) + 1 ) , batch_size ) : if shuffle : excerpt = indices [ start_idx : ( start_idx + batch_size ) ] else : excerpt = slice ( start_idx , ( start_idx + batch_size ) ) ( yield ( inputs [ excerpt ] , targets [ excerpt ] ) )
generate a generator that input a group of example in numpy .