def get_ith_minibatch_ixs(i, num_data, batch_size):
    """Split data into minibatches.
    
    @param i: integer
              iteration index
    @param num_data: integer
                     number of data points
    @param batch_size: integer
                       number of data points in a batch
    @return batch_slice: slice object
    """
    num_minibatches = num_data / batch_size + ((num_data % batch_size) > 0)
    i = i % num_minibatches
    start = i * batch_size
    stop = start + batch_size
    return slice(start, stop)