import torch


def iso_kl_div(mean: torch.Tensor, log_var: torch.Tensor) -> torch.Tensor:
    """KL-divergence between a Gaussian, specified by its mean and log-variance, and a standard Gaussian."""
    loss = 0.5 * (mean.pow(2) + log_var.exp() - log_var - 1)
    return loss.sum(1).mean()