MultiSolverInterface#

class MultiSolverInterface(problem, models, optimizers=None, schedulers=None, weighting=None, use_lt=True)[source]#

Bases: SolverInterface

Base class for PINA solvers using multiple torch.nn.Module.

Initialization of the MultiSolverInterface class.

Parameters:
  • problem (AbstractProblem) – The problem to be solved.

  • models – The neural network models to be used.

  • optimizers (list[Optimizer]) – The optimizers to be used. If None, the torch.optim.Adam optimizer is used for all models. Default is None.

  • schedulers (list[Scheduler]) – The schedulers to be used. If None, the torch.optim.lr_scheduler.ConstantLR scheduler is used for all the models. Default is None.

  • weighting (WeightingInterface) – The weighting schema to be used. If None, no weighting schema is used. Default is None.

  • use_lt (bool) – If True, the solver uses LabelTensors as input.

Raises:

ValueError – If the models are not a list or tuple with length greater than one.

configure_optimizers()[source]#

Optimizer configuration for the solver.

Returns:

The optimizer and the scheduler

Return type:

tuple[list[Optimizer], list[Scheduler]]

property models#

The models used for training.

Returns:

The models used for training.

Return type:

torch.nn.ModuleList

property optimizers#

The optimizers used for training.

Returns:

The optimizers used for training.

Return type:

list[Optimizer]

property schedulers#

The schedulers used for training.

Returns:

The schedulers used for training.

Return type:

list[Scheduler]