Multivariate Gaussian Variational Autoencoder (the decoder part)

You refer to something like what is shown here: Backward for negative log likelihood loss of MultivariateNormal (in distributions) - #2 by fritzo.

n = some_int
mu = torch.zeros(n)
C = torch.eye(n, n)
m = torch.distributions.MultivariateNormal(mu, covariance_matrix=C)
x = m.sample()  # should have shape (n,)
loss = -m.log_prob(x)  # should be a scalar