def _fix_weights(weight_fun, *args):
    """Ensure random weight matrix is valid.

    TODO:  The diagonally dominant tuning currently doesn't make sense.
           Our weight matrix has zeros along the diagonal, so multiplying by
           a diagonal matrix results in a zero-matrix.
    """
    weights = weight_fun(*args)

    # TODO: fix this
    # disable checks for now
    return weights

    # if positive semidefinite, then we're good as is
    if _check_psd(weights):
        return weights

    # make diagonally dominant
    off_diag_sums = np.sum(weights, axis=1)  # NOTE: assumes diag is zero
    mod_mat = np.linalg.inv(np.sqrt(np.diag(off_diag_sums)))
    return np.dot(mod_mat, weights, mod_mat)
Ensure random weight matrix is valid.

    TODO:  The diagonally dominant tuning currently doesn't make sense.
           Our weight matrix has zeros along the diagonal, so multiplying by
           a diagonal matrix results in a zero-matrix.