Base Solver#
Module for the base solver class.
- class BaseSolver(problem, use_lt=True)[source]
Bases:
SolverInterfaceBase class for all solvers, implementing common functionality.
All solvers must inherit from this class and implement abstract methods defined in
SolverInterface.This class is not meant to be instantiated directly.
Initialization of the
BaseSolverclass.- Parameters:
problem (BaseProblem) – The problem to be solved.
use_lt (bool) – If
True, the solver uses LabelTensors as input. Default isTrue.
- Raises:
ValueError – If
use_ltis not a boolean.ValueError – If
problemis not an instance ofBaseProblem.ValueError – If one or more problem conditions are not supported by the solver.
- reset()[source]
Reset the internal solver state, clearing the stored problem, models, optimizers and schedulers.
- training_step(batch, batch_idx)[source]
Solver training step.
- validation_step(batch, batch_idx)[source]
Solver validation step.
- test_step(batch, batch_idx)[source]
Solver test step.
- static get_batch_size(batch)[source]
Get the batch size.
- property problem
The problem instance.
- Returns:
The problem instance.
- Return type:
BaseProblem
- property use_lt
Using LabelTensors as input during training.
- Returns:
The use_lt attribute.
- Return type:
- property weighting
The weighting schema used by the solver.
- Returns:
The weighting schema used by the solver.
- Return type:
BaseWeighting
- property loss
The element-wise loss module used by the solver.
- Returns:
The element-wise loss module used by the solver.
- Return type: