MaxLogitCriterion#

class torch_uncertainty.ood_criteria.MaxLogitCriterion[source]#

OOD criterion based on the Max-Logit score (Hendrycks et al.).

Defined as the negative of the highest logit value (averaged over estimators in the ensemble case):

\[\text{score}(\mathbf{z}) = -\max_{i} z_i.\]

Lower maximum logits indicate greater uncertainty.

Variables:

input_type – Expected input type is logits.

forward(inputs)[source]#

Compute the negative of the maximum logit value.

Parameters:

inputs (Tensor) – Tensor of logits with shape (batch_size, num_estimators, num_classes).

Returns:

Negative of the maximum logit value for each sample.

Return type:

Tensor