otf.optim.lr_scheduler
Learning-rate schedulers for optimizers.
Provides a small set of scheduler helpers that adjust an optimizer's
learning_rate attribute over time. Implementations are lightweight and
intended to be used with BaseOptimizer instances in the optim package.
Classes:
| Name | Description |
|---|---|
DummyLRScheduler |
No-op scheduler for testing and compatibility. |
ExponentialLR |
Multiply an optimizer's learning rate by a constant factor on each |
LRScheduler |
Abstract base for learning-rate schedulers that modify an optimizer's |
MultiStepLR |
Reduce learning rate at specified step milestones. |
DummyLRScheduler
Bases: LRScheduler
No-op scheduler for testing and compatibility.
Initialize a dummy scheduler (accepts arbitrary args).
This scheduler performs no action when step is called.
Source code in src/otf/optim/lr_scheduler.py
ExponentialLR
Bases: LRScheduler
Multiply an optimizer's learning rate by a constant factor on each
step() call.
Initialize the exponential scheduler.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
optimizer
|
BaseOptimizer
|
An instance of |
required |
gamma
|
float
|
Factor to multiply the learning rate by on each |
0.99
|
Source code in src/otf/optim/lr_scheduler.py
LRScheduler
Abstract base for learning-rate schedulers that modify an optimizer's
learning_rate attribute.
Create a scheduler bound to optimizer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
optimizer
|
BaseOptimizer
|
|
required |
Source code in src/otf/optim/lr_scheduler.py
MultiStepLR
Bases: LRScheduler
Reduce learning rate at specified step milestones.
Initialize the multi-step scheduler.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
optimizer
|
BaseOptimizer
|
An instance of |
required |
milestones
|
list[int] | tuple[int]
|
For each milestone, update the learning rate after that many calls
to |
required |
gamma
|
float
|
Factor by which to multiply the learning rate at each milestone. |
0.5
|