def get_minibatches_idx(n, minibatch_size, shuffle=False):
 idx_list = numpy.arange(n, dtype='int32')
 if shuffle:
  numpy.random.shuffle(idx_list)
 minibatches = []
 minibatch_start = 0
 for i in range((n // minibatch_size)):
  minibatches.append(idx_list[minibatch_start:(minibatch_start + minibatch_size)])
  minibatch_start += minibatch_size
 if (minibatch_start != n):
  minibatches.append(idx_list[minibatch_start:])
 return zip(range(len(minibatches)), minibatches)

def get_minibatches_idx ( n , minibatch_size , shuffle = False ) : idx_list = numpy . arange ( n , dtype = 'int32' ) if shuffle : numpy . random . shuffle ( idx_list ) minibatches = [ ] minibatch_start = 0 for i in range ( ( n // minibatch_size ) ) : minibatches . append ( idx_list [ minibatch_start : ( minibatch_start + minibatch_size ) ] ) minibatch_start += minibatch_size if ( minibatch_start != n ) : minibatches . append ( idx_list [ minibatch_start : ] ) return zip ( range ( len ( minibatches ) ) , minibatches )
used to shuffle the dataset at each iteration .