Skip to content

forward_only_validator

ForwardOnlyValidator

This is basically a pass-through function. It returns the best score and best epoch that is returned by the inner adapter.

Source code in pytorch_adapt\meta_validators\forward_only_validator.py
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
class ForwardOnlyValidator:
    """
    This is basically a pass-through function.
    It returns the best score and best epoch
    that is returned by the inner adapter.
    """

    def run(self, adapter, **kwargs) -> Tuple[float, int]:
        """
        Arguments:
            adapter: the framework-wrapped adapter.
            **kwargs: keyword arguments to be passed into adapter.run()
        Returns:
            the best score and best epoch
        """
        if not adapter.validator:
            raise KeyError(
                "An adapter validator is required when using ForwardOnlyValidator"
            )
        return adapter.run(**kwargs)

run(adapter, **kwargs)

Parameters:

Name Type Description Default
adapter

the framework-wrapped adapter.

required
**kwargs

keyword arguments to be passed into adapter.run()

{}

Returns:

Type Description
Tuple[float, int]

the best score and best epoch

Source code in pytorch_adapt\meta_validators\forward_only_validator.py
11
12
13
14
15
16
17
18
19
20
21
22
23
def run(self, adapter, **kwargs) -> Tuple[float, int]:
    """
    Arguments:
        adapter: the framework-wrapped adapter.
        **kwargs: keyword arguments to be passed into adapter.run()
    Returns:
        the best score and best epoch
    """
    if not adapter.validator:
        raise KeyError(
            "An adapter validator is required when using ForwardOnlyValidator"
        )
    return adapter.run(**kwargs)