data
VAEOutput
extends
ModelOutputVAEOutput(sample: Tensor, latent: Tensor, mu: Tensor, logvar: Tensor, loss: Tensor | None = None, recon_loss: Tensor | None = None, kl_loss: Tensor | None = None)End-to-end VAE forward output.
Attributes
sampleTensorReconstructed image shaped
(B, C, H, W).latentTensorSampled latent , shape
(B, latent_dim).muTensorEncoder mean .
logvarTensorEncoder log-variance .
loss(Tensor or None, optional)Total ELBO loss (
recon_loss + β · kl_loss) when targets were
supplied to forward.recon_loss(Tensor or None, optional)Reconstruction term alone (typically BCE or MSE).
kl_loss(Tensor or None, optional)KL divergence term alone.
Notes
Returned by VAEModel.forward. VAEForImageGeneration
wraps the decoder for unconditional sampling and returns
GenerationOutput from its generate method.
Examples
>>> model = create_model("vae")
>>> out = model(images)
>>> out.sample.shape, out.mu.shape
((4, 3, 64, 64), (4, 128))