Class Vae
java.lang.Object
ai.beestream.jitnn.nn.Module
ai.beestream.jitnn.nn.models.Vae
- All Implemented Interfaces:
AutoCloseable
A fully connected variational autoencoder (Kingma and Welling, 2014), the layout of PyTorch's
MNIST example: 784-400 encoder to a Gaussian latent (mean, log-variance), 400-784 decoder with
a sigmoid output. Seeds, in order: encoder, mean, log-variance, decoder hidden, decoder output.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordReconstruction probabilities [B, in] and the latent mean and log-variance [B, latent]. -
Constructor Summary
ConstructorsConstructorDescriptionVae(int in, int hidden, int latent, long seed) An autoencoder ofinfeatures throughhiddento a latent oflatentvalues, initialised fromseed. -
Method Summary
Modifier and TypeMethodDescriptionDecodes latent vectors z [B, latent] to [B, in], each value in (0, 1).Reconstruction with the mean latent (no sampling).intlatent()The size of the latent vector.static Tensorloss(Vae.Output o, Tensor x) The negative ELBO per sample: (binary cross-entropy summed over pixels + KL) / B.Encodes x [B, in], samples z = mu + exp(logvar / 2) eps with the given noise eps [B, latent], decodes.Methods inherited from class Module
buffer, buffers, child, close, isClosed, isTraining, loadStateDict, parameter, parameterCount, parameters, stateDict, train, zeroGrad
-
Constructor Details
-
Vae
public Vae(int in, int hidden, int latent, long seed) An autoencoder ofinfeatures throughhiddento a latent oflatentvalues, initialised fromseed.
-
-
Method Details
-
latent
public int latent()The size of the latent vector. -
run
Encodes x [B, in], samples z = mu + exp(logvar / 2) eps with the given noise eps [B, latent], decodes. -
decode
-
loss
The negative ELBO per sample: (binary cross-entropy summed over pixels + KL) / B. -
forward
-