data
NormalizingFlowOutput
extends
ModelOutputNormalizingFlowOutput(latent: Tensor, log_det_jacobian: Tensor, log_prob: Tensor, loss: Tensor | None = None)Forward output of an exact-likelihood normalizing flow.
A flow's forward direction is the inference direction — it maps data to the latent space and reports how much volume the map contracted, so the exact log-density comes out of a single pass.
Attributes
latentTensorLatent code , shape
(B, D) with
D = C · H · W for image flows (the bijection is defined on the
flattened sample).log_det_jacobianTensorPer-sample ,
shape
(B,). Volume-preserving stages (additive coupling,
permutations) contribute exactly zero.log_probTensorPer-sample exact log-likelihood, shape
(B,):
loss(Tensor or None, optional)Scalar negative log-likelihood
-log_prob.mean(), populated by
the task wrapper (the bare trunk leaves it None).Notes
Returned by NICEModel.forward and every other flow trunk /
…ForImageGeneration head. Sampling runs the bijection backwards
and returns GenerationOutput instead.
Examples
>>> import lucid
>>> from lucid.models import NormalizingFlowOutput
>>> out = NormalizingFlowOutput(
... latent=lucid.zeros(4, 128),
... log_det_jacobian=lucid.zeros(4),
... log_prob=lucid.zeros(4),
... )
>>> out.latent.shape, out.log_prob.shape
((4, 128), (4,))