import torch


def kl_loss_full(mean, var, mean_prior, var_prior):
    """
    KL divergence of two multivariate normal distributions.

    :param mean: mean of distribution 1
    :param var: covariance of distribution 1
    :param mean_prior: mean of distribution 2
    :param var_prior: covariance of distribution 2
    :return: KL divergence of distribution 1 and 2
    """
    mvn = torch.distributions.MultivariateNormal(loc=mean, covariance_matrix=var)
    prior = torch.distributions.MultivariateNormal(loc=mean_prior, covariance_matrix=var_prior)
    return torch.distributions.kl_divergence(mvn, prior).mean()