KLDivergence
- class lightning_ir.loss.listwise.KLDivergence[source]
Bases:
ListwiseLossFunctionKullback-Leibler Divergence loss for listwise ranking tasks. Originally proposed in: On Information and Sufficiency
Methods
compute_loss(output, batch)Compute the Kullback-Leibler Divergence loss.
- compute_loss(output: LightningIROutput, batch: TrainBatch) torch.Tensor[source]
Compute the Kullback-Leibler Divergence loss.
- Parameters:
output (LightningIROutput) – The output from the model containing scores.
batch (TrainBatch) – The training batch containing targets.
- Returns:
The computed loss.
- Return type:
torch.Tensor