pugh_torch.optimizers package¶
Submodules¶
pugh_torch.optimizers.base module¶
pugh_torch.optimizers.lookahead module¶
Lookahead Optimizer Wrapper. Implementation modified from: https://github.com/alphadl/lookahead.pytorch Paper: Lookahead Optimizer: k steps forward, 1 step back - https://arxiv.org/abs/1907.08610
-
class
pugh_torch.optimizers.lookahead.Lookahead(base_optimizer, alpha=0.5, k=6)[source]¶ Bases:
pugh_torch.optimizers.base.Optimizer-
load_state_dict(state_dict)[source]¶ Loads the optimizer state.
- Arguments:
- state_dict (dict): optimizer state. Should be an object returned
from a call to
state_dict().
-
state_dict()[source]¶ Returns the state of the optimizer as a
dict.It contains two entries:
- state - a dict holding current optimization state. Its content
differs between optimizer classes.
param_groups - a dict containing all parameter groups
-
step(closure=None)[source]¶ Performs a single optimization step (parameter update).
- Arguments:
- closure (callable): A closure that reevaluates the model and
returns the loss. Optional for most optimizers.
Note
Unless otherwise specified, this function should not modify the
.gradfield of the parameters.
-
pugh_torch.optimizers.ralamb module¶
- Modified from:
-
class
pugh_torch.optimizers.ralamb.Ralamb(params, lr=0.001, betas=(0.9, 0.999), eps=1e-08, weight_decay=0)[source]¶ Bases:
pugh_torch.optimizers.base.Optimizer-
step(closure=None)[source]¶ Performs a single optimization step (parameter update).
- Arguments:
- closure (callable): A closure that reevaluates the model and
returns the loss. Optional for most optimizers.
Note
Unless otherwise specified, this function should not modify the
.gradfield of the parameters.
-
pugh_torch.optimizers.rangerlars module¶
- Modified from: