Skip to content

entropy_validator

EntropyValidator

Bases: SimpleLossValidator

Returns the negative of the entropy of all logits.

Source code in pytorch_adapt\validators\entropy_validator.py
 5
 6
 7
 8
 9
10
11
12
13
14
class EntropyValidator(SimpleLossValidator):
    """
    Returns the negative of the
    [entropy][pytorch_adapt.layers.entropy_loss.EntropyLoss]
    of all logits.
    """

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