pytorch-vae
pytorch-vae copied to clipboard
VAE
Hello,
How can I look at the latent space in the pytorch VAE code? I know how to do this in keras, but have not yet figured it out in pytorch.
Thanks!
I think I can answer this.
In his code, you can do
fixed_x, _ = next(iter(data_loader))
fixed_x = flatten(fixed_x)
_, mu, logvar = vae(fixed_x)
Then the latent space for the image fixed_x
follows the normal distribution with mean mu
and variance logvar.exp()