def get_batch_inds(idx, params):
    """
    Given a list of indices (random sorting happens outside), break into batches of indices for training
    :param idx: list of indices to break
    :param params: input parameters from params.py
    :return: List where each entry contains batch indices to pass through at the current iteration
    """

    N = len(idx)
    batchInds = []
    idx0 = 0
    toProcess = True
    while toProcess:
        idx1 = idx0 + params.BATCH_SZ
        if idx1 > N:
            idx1 = N
            idx0 = idx1 - params.BATCH_SZ
            toProcess = False
        batchInds.append(idx[idx0:idx1])
        idx0 = idx1
    return batchInds