torchcell.losses.list_mle.ListMLELoss

class ListMLELoss[source]

Bases: Module

Listwise Maximum Likelihood Estimation ranking loss.

forward(y_pred: Tensor, y_true: Tensor) → Tensor[source]

Compute the ListMLE loss given predictions and true values.

Parameters: - y_pred: A tensor of predictions from the model, shape (batch_size, list_size). - y_true: A tensor of true scores or relevance, shape (batch_size, list_size).

Returns: - loss: The ListMLE loss for the batch.