SingleSolverInterface#
- class SingleSolverInterface(problem, model, optimizer=None, scheduler=None, weighting=None, use_lt=True)[source]#
Bases:
SolverInterface
Base class for PINA solvers using a single
torch.nn.Module
.Initialization of the
SingleSolverInterface
class.- Parameters:
problem (AbstractProblem) – The problem to be solved.
model (torch.nn.Module) – The neural network model to be used.
optimizer (Optimizer) – The optimizer to be used. If
None
, thetorch.optim.Adam
optimizer is used. Default isNone
.scheduler (Scheduler) – The scheduler to be used. If
None
, thetorch.optim.lr_scheduler.ConstantLR
scheduler is used. Default isNone
.weighting (WeightingInterface) – The weighting schema to be used. If
None
, no weighting schema is used. Default isNone
.use_lt (bool) – If
True
, the solver uses LabelTensors as input.
- forward(x)[source]#
Forward pass implementation.
- Parameters:
x (torch.Tensor | LabelTensor) – Input tensor.
- Returns:
Solver solution.
- Return type:
- property model#
The model used for training.
- Returns:
The model used for training.
- Return type:
- property scheduler#
The scheduler used for training.
- Returns:
The scheduler used for training.
- Return type: