optimization.optimizer.torch.adam
Torch Adam Optimizer
This module contains an implementation of the Adam optimizer for PyTorch.
Kramer Harrison, 2025
Classes
|
An optimizer that uses the PyTorch Adam algorithm. |
- class TorchAdamOptimizer(problem: OptimizationProblem)[source]
An optimizer that uses the PyTorch Adam algorithm.
This optimizer leverages automatic differentiation to perform gradient-based optimization on an OptimizationProblem.
- optimize(n_steps: int = 100, lr: float = 0.01, gamma: float = 0.99, disp: bool = True, plot: bool = False, callback: Callable[[int, float], None] | None = None)
Runs the optimization loop.
- Parameters:
n_steps (int) – The number of optimization steps.
lr (float) – The learning rate.
gamma (float) – The decay factor for the learning rate.
disp (bool) – Whether to display progress.
plot – If True, update live plots during optimization.
callback (Callable[[int, float], None] | None) – A callback function to be called after each step with the current step and loss value.