def iv_collect(arg, q):
    """
    Consumer method that takes inputs from a queue and fill matrices with i-vectors
    and uncertainty matrices (diagonal version only)

    :param arg:a tuple of inputs including a matrix to store i-vectors and a matrix to store uncertainty matrices
    :param q: the input queue (a multiprocessing.Queue object)
    :return: the matrices of i-vectors and uncertainty matrices
    """
    iv, iv_sigma = arg
    while True:
        batch_idx, e_h, e_hh = q.get()
        if e_h is None:
            break
        iv[(batch_idx), :] = e_h
        iv_sigma[(batch_idx), :] = e_hh
    return iv, iv_sigma
