Skip to content

declearn.optimizer.list_optim_regularizers

Return a mapping of registered Regularizer subclasses.

This function aims at making it easy for end-users to list and access all available Regularizer optimizer plug-ins at any given time. The returned dict uses unique identifier keys, which may be used to add the associated plug-in to a declearn.optimizer.Optimizer without going through the fuss of importing and instantiating it manually.

Note that the mapping will include all declearn-provided plug-ins, but also registered plug-ins provided by user or third-party code.

See also

Returns:

Name Type Description
mapping Dict[str, Type[Regularizer]]

Dictionary mapping unique str identifiers to Regularizer class constructors.

Source code in declearn/optimizer/_utils.py
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
def list_optim_regularizers() -> Dict[str, Type[Regularizer]]:
    """Return a mapping of registered Regularizer subclasses.

    This function aims at making it easy for end-users to list and access
    all available Regularizer optimizer plug-ins at any given time. The
    returned dict uses unique identifier keys, which may be used to add
    the associated plug-in to a [declearn.optimizer.Optimizer][] without
    going through the fuss of importing and instantiating it manually.

    Note that the mapping will include all declearn-provided plug-ins,
    but also registered plug-ins provided by user or third-party code.

    See also
    --------
    * [declearn.optimizer.regularizers.Regularizer][]:
        API-defining abstract base class for the Regularizer plug-ins.
    * [declearn.optimizer.list_optim_modules][]:
        Counterpart function for OptiModule plug-ins.

    Returns
    -------
    mapping:
        Dictionary mapping unique str identifiers to Regularizer
        class constructors.
    """
    return access_types_mapping("Regularizer")