I am recently reading about Variational Autoencoder. In this method, z
is sampled from normal distribution. I found some existing code like below.
eps = srng.normal((self.L, mu.shape[0], self.n_latent))
# Reparametrize
z = mu + T.exp(0.5 * log_sigma) * eps
https://github.com/y0ast/Variational-Autoencoder/blob/master/VAE.py#L107
mean, var = args
epsilon = K.random_normal(K.shape(mean))
return mean+var*epsilon
https://github.com/rarilurelo/keras-VAE/blob/master/probability_distributions.py#L30
But I am not sure how comes from the formula. I could imagine of using mu
, but I have no idea about the second calculation. I assume it comes from variance of data. Could you describe more details about this?