import torch


def batched_logprob(target, mu, sigma):
    """ Mean of log probability of targets given mu and sigmas of a Gaussian
    distribution """
    target = target.reshape(mu.shape)
    dist = torch.distributions.normal.Normal(mu, sigma)
    return torch.mean(dist.log_prob(target))