pytorch-vae icon indicating copy to clipboard operation
pytorch-vae copied to clipboard

VAE

Open rojinsafavi opened this issue 5 years ago • 1 comments

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!

rojinsafavi avatar Apr 14 '19 18:04 rojinsafavi

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()

ZeratuuLL avatar Apr 14 '19 22:04 ZeratuuLL