prior_denoising
prior_denoising
¶
Denoising loss for learned diffusion priors.
PriorDenoisingLoss
¶
Bases: ScalarWeightedLoss
Denoising loss for learned diffusion prior.
Computes MSE loss between predicted noise and target noise from the diffusion prior. Used in variational models to train the prior p(z|s) to match the posterior q(z|a,s).
Initialize prior denoising loss.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
weight
|
float
|
Weight for this loss component |
1.0
|
Source code in src/versatil/metrics/losses/prior_denoising.py
get_required_keys
¶
forward
¶
Compute prior denoising loss.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
predictions
|
dict[str, Tensor]
|
Dictionary containing LatentKey.PRIOR_PREDICTION.value and LatentKey.PRIOR_TARGET.value |
required |
targets
|
dict[str, Tensor]
|
Not used (targets are in predictions dict) |
required |
is_pad
|
Tensor | None
|
Not used (prior loss doesn't need padding) |
None
|
Returns:
| Type | Description |
|---|---|
LossOutput
|
LossOutput with weighted MSE loss |
Raises:
| Type | Description |
|---|---|
ValueError
|
If required keys are missing from predictions |