Skip to content

im_validator

IMValidator

Bases: MultipleValidators

The sum of EntropyValidator and DiversityValidator

Source code in pytorch_adapt\validators\im_validator.py
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
class IMValidator(MultipleValidators):
    """
    The sum of [EntropyValidator][pytorch_adapt.validators.EntropyValidator]
    and [DiversityValidator][pytorch_adapt.validators.DiversityValidator]
    """

    def __init__(self, weights=None, **kwargs):
        layer = kwargs.pop("layer", None)
        inner_kwargs = {} if not layer else {"layer": layer}
        validators = {
            "entropy": EntropyValidator(**inner_kwargs),
            "diversity": DiversityValidator(**inner_kwargs),
        }
        super().__init__(validators=validators, weights=weights, **kwargs)