def factored_gaussian_params_fn(mean_x, cov_x, mean_y, cov_y):
    """calculate the parameters of the gaussian q(z | y)q(z | x)

    Given that the form of the gaussian q(z | x, y) \propto q(z | x)q(z | y)
    is another gaussian with closed form covariance and mean vectors, we
    can easily get it from the output of the two networks

    :param mean_x: ((N * z_dim) tensor) mean from input x
    :param cov_x: ((N * z_dim) tensor) covariance diagonal from input x
    :param mean_y: ((N * z_dim) tensor) mean from input y
    :param cov_y: ((N * z_dim) tensor) covariance diagonal from input y

    :return mean_q: ((N * z_dim) tensor) mean of the q-gaussian
    :return cov_q: ((N * z_sim) tensor) covariance of the q-gaussian"""
    cov_q = 1.0/((1.0/cov_x) + (1.0/cov_y))
    mean_q = ((1.0/cov_x) * mean_x + (1.0/cov_y) * mean_y) * cov_q

    return mean_q, cov_q