peal.generators.interfaces.InvertibleGenerator¶
- class peal.generators.interfaces.InvertibleGenerator[source]¶
Bases:
GeneratorA generator with an explicit, invertible latent space.
Adds
encode/decodeand a prior (sample_z,log_prob_z) toGenerator; the diffusion autoencoders, the VAEs and the RAE pipeline are all of this kind. Counterfactual methods such as DiDAE need this level because they perturb a latent code and decode the result.sample_xandlog_prob_xare already implemented in terms of the latent operations, so a subclass only supplies the four abstract methods.Notes
The optional
t,stochasticandnum_stepsarguments ofencode/decodeare the diffusion controls (how far to noise, whether to use the stochastic sampler, how many sampler steps); non-diffusion subclasses ignore them.Methods
This function decodes a batch of latent vectors to data samples :param z: A batch of latent vectors
This function encodes a batch of data samples to latent vectors :param x: A batch of data samples
This function computes the log probability of a batch of data samples :param x: A batch of data samples
This function computes the log probability of a batch of latent vectors :param z: A batch of latent vectors
This function samples a batch of data samples from the generator
This function samples a batch of latent vectors from the prior If not implemented, it will throw a NotImplementedError.
- abstract encode(x, t=1.0, stochastic=None, num_steps=None)[source]¶
This function encodes a batch of data samples to latent vectors :param x: A batch of data samples
- Returns:
A batch of latent vectors
If not implemented, it will throw a NotImplementedError.
- abstract decode(z, t=1.0, stochastic=None, num_steps=None)[source]¶
This function decodes a batch of latent vectors to data samples :param z: A batch of latent vectors
- Returns:
A batch of data samples
If not implemented, it will throw a NotImplementedError.
- sample_z(batch_size=1)[source]¶
This function samples a batch of latent vectors from the prior If not implemented, it will throw a NotImplementedError.