PairwiseLossFunction

class lightning_ir.loss.base.PairwiseLossFunction[source]

Bases: ScoringLossFunction

Base class for pairwise loss functions.

Methods

get_pairwise_idcs(targets)

Get pairwise indices for positive and negative samples based on targets.

get_pairwise_idcs(targets: Tensor) Tuple[Tensor, ...][source]

Get pairwise indices for positive and negative samples based on targets.

Parameters:

targets (torch.Tensor) – The targets tensor containing relevance labels.

Returns:

Indices of positive and negative samples.

Return type:

Tuple[torch.Tensor, …]