Skip to content

diversity_validator

DiversityValidator

Bases: SimpleLossValidator

Returns the negative of the diversity of all logits.

Source code in pytorch_adapt\validators\diversity_validator.py
 5
 6
 7
 8
 9
10
11
12
13
14
class DiversityValidator(SimpleLossValidator):
    """
    Returns the negative of the
    [diversity][pytorch_adapt.layers.diversity_loss.DiversityLoss]
    of all logits.
    """

    @property
    def loss_fn(self):
        return DiversityLoss(after_softmax=self.layer == "preds")