Skip to content
data

GenerationOutput

extendsModelOutput
GenerationOutput(samples: Tensor, intermediates: tuple[Tensor, ...] | None = None)

Final result of a generative model's sampling loop.

Attributes

samplesTensor
Final (n_samples, C, H, W) (image), (n_samples, D) (vector flow) or (n_samples, T) (text) batch produced by the sampler.
intermediates(tuple[Tensor, ...] or None, optional)
Per-step latents / samples — populated only when the caller passes return_intermediates=True to generate. Useful for animating trajectories or debugging schedulers.

Notes

Returned by DiffusionMixin.generate and VAEForImageGeneration.generate. Text generation through CausalLMMixin.generate currently returns a bare Tensor rather than this wrapper — that may change.

Examples

>>> import lucid
>>> from lucid.models import GenerationOutput
>>> out = GenerationOutput(samples=lucid.zeros(4, 3, 32, 32))
>>> out.samples.shape
(4, 3, 32, 32)
intermediates is filled only when the caller asks to keep the
trajectory, which costs one tensor per step.
>>> out.intermediates is None
True

Used by 16

… 4 more