def draw_mini_indices(n_samples, batch_size):
    assert n_samples > batch_size
    idxs = range(n_samples)
    random.shuffle(idxs)
    pos = 0

    while True:
        while pos + batch_size <= n_samples:
             yield idxs[pos:pos + batch_size]
             pos += batch_size

        batch = idxs[pos:]
        needed = len(batch) - batch_size
        random.shuffle(idxs)
        batch += idxs[0:needed]
        yield batch
        pos = needed
dataset/ETHPy150Open BRML/climin/climin/util.py/draw_mini_indices/swapped operands of `-`