def make_batches(size, batch_size):
    nb_batch = int(np.ceil(size / float(batch_size)))
    return [(i * batch_size, min(size, (i + 1) * batch_size))
            for i in range(0, nb_batch)]
Returns a list of batch indices (tuples of indices).
dataset/ETHPy150Open fchollet/keras/keras/engine/training.py/make_batches