paraqeet.optimizable.Optimizable#
- class paraqeet.optimizable.Optimizable[source]#
Bases:
ABCOptimizable parameter model.
This interface must be implemented by any class that provides optimizable parameters. The optimizer will collect all parameters (by reference) and update their values.
- Parameters:
_name (str | None) – The name of the object.
_optimizable_parameters (list[Quantity] = []) – The optimizable parameters associated with the object.
_all_optimizable_parameters (list[Quantity] = []) – All the optimizable parameters considered in the optimization. This is needed to set correctly the size of the gradient and its ordering.
- __init__()#
Methods
__init__()Return all parameters of this class that can be optimized.
set_all_optimizable_parameters(all_params)Set all optimizable parameters in the optimization.
set_optimizable_parameters(params)Set which parameters associated with the object shall be considered during optimization.
Attributes
Get the optimizable parameters
Get the name of the parameter.
Get the optimizable parameters
- property all_optimizable_parameters: list[Quantity]#
Get the optimizable parameters
- Returns:
The list of all the optimizable parameters considered in the optimization
- Return type:
list[Quantity]
- abstract get_parameters()[source]#
Return all parameters of this class that can be optimized.
- Raises:
NotImplementedError – Subclasses derived from this class must implement this method.
- Return type:
list[Quantity]
- property name: str | None#
Get the name of the parameter.
- Returns:
Name of the parameter.
- Return type:
str | None
- property optimizable_parameters: list[Quantity]#
Get the optimizable parameters
- Returns:
The list of optimizable parameters associated with the object.
- Return type:
list[Quantity]
- set_all_optimizable_parameters(all_params)[source]#
Set all optimizable parameters in the optimization.
- set_optimizable_parameters(params)[source]#
Set which parameters associated with the object shall be considered during optimization.
All quantities that are not in the response of get_parameters will be filtered out. This function is called by the optimizer before gradient based optimization to tell the layers which gradients to compute.
- Parameters:
params (list[Quantity]) – List of optimizable parameters to be set.
- Return type:
None