You can just use torch.distributions.Normal in that case
import torch
n = 2
d = 5
diagonal = torch.rand(d) + 1.
mu = torch.rand(n, d)
p1 = torch.distributions.Normal(mu, diagonal.reshape(1, d))
p2 = torch.distributions.MultivariateNormal(mu, scale_tril=torch.diag(diagonal).reshape(1, d, d))
x = torch.rand((n,d))
print(p1.log_prob(x).sum(dim=1) - p2.log_prob(x))