ScoreBasedInBatchCrossEntropy
- class lightning_ir.loss.in_batch.ScoreBasedInBatchCrossEntropy(min_target_diff: float, max_num_neg_samples: int | None = None)[source]
Bases:
ScoreBasedInBatchLossFunctionIn-batch cross-entropy loss function based on scores for ranking tasks.
Methods
compute_loss(output)Compute the in-batch cross-entropy loss based on scores.
- compute_loss(output: LightningIROutput) torch.Tensor[source]
Compute the in-batch cross-entropy loss based on scores.
- Parameters:
output (LightningIROutput) – The output from the model containing scores.
- Returns:
The computed loss.
- Return type:
torch.Tensor