Manual Optimization Mixin#
Module for the manual optimization mixin class.
- class ManualOptimizationMixin[source]
Bases:
objectMixin that handles Lightning manual optimization loops, useful for solvers that require explicit control over optimization steps, such as those with multiple optimizers or custom training loops.
Designed to be used in combination with any solver inheriting from
BaseSolver.- training_step(batch, batch_idx)[source]
Solver training step.
- on_train_batch_end(outputs, batch, batch_idx)[source]
Keep Lightning’s manual optimization progress counters in sync.
This hook increments the completed optimization-step counter used by Lightning’s manual optimization loop, then delegates to the parent implementation.
- Parameters:
- Returns:
The result returned by the parent class implementation.
- Return type:
Any