A Variational Autoencoder (VAE) learns a probabilistic latent space representation. The encoder maps input x to mean/logvar of a Gaussian distribution. The decoder samples from this distribution to reconstruct x. The loss combines reconstruction (MSE/BCE) and KL divergence regularization.
L=Eqϕ(z∣x)[logpψ(x∣z)]−DKL(qϕ(z∣x)∣∣p(z))Where q is the encoder, p is the decoder, and p(z) = N(0, I).
Implement:
vae_loss(x_recon, x_true, mu, logvar)
Computes the evidence lower bound (ELBO) loss for VAE training.
No results yet
Run your code to check it against the examples, or submit to run every test.