Skip to content
data

DiffusionModelOutput

extendsModelOutput
DiffusionModelOutput(sample: Tensor, loss: Tensor | None = None)

Single-step output of a diffusion U-Net's forward pass.

Attributes

sampleTensor
Network prediction at the supplied timestep. The semantic interpretation depends on the parameterisation declared in DiffusionModelConfig.prediction_type:
  • "epsilon" — predicted noise ε\varepsilon.
  • "sample" — predicted clean signal x0x_0.
  • "v" — predicted velocity v=αtε−σtx0v = \alpha_t \varepsilon - \sigma_t x_0.
loss(Tensor or None, optional)
Scalar training loss against ground-truth noise (MSE for the "epsilon" parameterisation).

Notes

Returned by _DDPMUNet.forward and other diffusion noise predictors. The sampling loop in DiffusionMixin reads sample and passes it to the scheduler's step method.

Examples

>>> import lucid
>>> from lucid.models import DiffusionModelOutput
>>> out = DiffusionModelOutput(sample=lucid.zeros(1, 3, 32, 32))
>>> out.sample.shape
(1, 3, 32, 32)

Used by 9