Construct a convolutional VAE with a single bottleneck latent.
Vanilla VAE topology following Kingma and Welling, 2014, configured with
a 32x32 input, down_block_channels=(64, 128, 256) (three stride-2
encoder stages — 32 -> 16 -> 8 -> 4), and a 128-dimensional latent.
Pass latent_dim as a tuple of integers to switch to the
hierarchical topology, or call hvae directly to use the
Sønderby 3-level stack default.
Pass kl_weight!=1.0 to obtain a -VAE (Higgins 2017).
Model Size
Parameters
pretrainedbool= False**overridesobject= {}VAEConfig field overrides (e.g. latent_dim=...,
kl_weight=..., recon_loss="bce") forwarded into the
underlying config.Returns
VAEModelConvolutional VAE trunk configured with the vanilla defaults and any overrides.
Notes
Reference: Kingma and Welling, "Auto-Encoding Variational Bayes", ICLR, 2014 (arXiv:1312.6114); -VAE in Higgins et al., "beta-VAE: Learning Basic Visual Concepts with a Constrained Variational Framework", ICLR, 2017.
Reparameterisation trick:
Examples
>>> import lucid
>>> from lucid.models.generative.vae import vae
>>> model = vae().eval()
>>> x = lucid.randn((1, 3, 32, 32))
>>> out = model(x)
>>> out.sample.shape, out.latent.shape
((1, 3, 32, 32), (1, 128))