AntixK / PyTorch-VAE

A Collection of Variational Autoencoders (VAE) in PyTorch.
Apache License 2.0
6.44k stars 1.05k forks source link

changed nn.Tanh() output layers to nn.Sigmoid() #63

Open HareshKarnan opened 2 years ago

HareshKarnan commented 2 years ago

The input image is normalized between 0-1, so the output should be a nn.Sigmoid() layer instead of nn.Tanh(). Note that nn.Tanh() may also work, but using nn.Sigmoid() is more appropriate and will make the learning easier since the network can now only output values between 0-1 every pixel.

DerEchteFeuerpfeil commented 1 year ago

Had the same issue with the VanillaVAE out-of-the-box when converting first iteration samples to a PIL Image. Commenting to bump this up.