# A question on Variational(VAE) Autoencoder

I recently worked on Variational(VAE) Autoencoder. For me, Autoencoder works like this:

In the loss function, we have

• a reconstruction error term which allows us to minimize the distance between input and output.
• a regularization term which allows us to match the latent variables(z1,z2) to a unit gaussian distribution.

But does someone know why do we introduce the random effect? To match a gaussian distribution, why not just use a gaussian likehood as a regularization term of loss function?

The answer might be from a bayes prospective of VAE autoencoder? Even a small hint might be of great help, thanks!

As shown in the figure, the encoder produces $\mu$ and $\sigma$, which are the mean and standard deviation of the posterior distribution $q(z|x)$.
The random effect comes from drawing samples from the posterior distribution. Each sample $z$ can be obtained by $z = \mu+\sigma\epsilon$, where $\epsilon$ is a sample from a Gaussian distribution with zero mean and unit variance, which can be easily obtained.