How to use a VAE to reconstruct an image starting from an initial image instead of starting from a random vector?
The thing is, the decoder samples from a latent mu and sigma, so you cant sample from a raw image directly. But if you’re trying to put a random image into the encoder of a trained VAE to match it to some sample image (via reconstruction loss), then your random input image will converge to the target sample.

This will work when the following VAE architecture constraints are satisfied:


The target sample is contained in the previously used training distribution.
The parameters of the VAE are frozen after training.
The input image values are “backpropagate-able”. (Interpret the input image as optimizable parameters.)