Solver Interface#

Module for the solver interface.

class SolverInterface(*args: Any, **kwargs: Any)[source]

Bases: LightningModule

Abstract base class for PINA solvers. All specific solvers must inherit from this interface. This class extends LightningModule, providing additional functionalities for defining and optimizing Deep Learning models.

By inheriting from this base class, solvers gain access to built-in training loops, logging utilities, and optimization techniques.

abstract training_step(batch, batch_idx)[source]

Solver training step.

Parameters:
  • batch (list[tuple[str, dict]]) – A batch of data. Each element is a tuple containing a condition name and a dictionary of points.

  • batch_idx (int) – The index of the current batch.

Returns:

The loss of the training step.

Return type:

torch.Tensor

abstract validation_step(batch, batch_idx)[source]

Solver validation step.

Parameters:
  • batch (list[tuple[str, dict]]) – A batch of data. Each element is a tuple containing a condition name and a dictionary of points.

  • batch_idx (int) – The index of the current batch.

Returns:

The loss of the training step.

Return type:

torch.Tensor

abstract test_step(batch, batch_idx)[source]

Solver test step.

Parameters:
  • batch (list[tuple[str, dict]]) – A batch of data. Each element is a tuple containing a condition name and a dictionary of points.

  • batch_idx (int) – The index of the current batch.

Returns:

The loss of the training step.

Return type:

torch.Tensor

abstract property problem

The problem instance.

Returns:

The problem instance.

Return type:

BaseProblem

abstract property use_lt

Using LabelTensors as input during training.

Returns:

The use_lt attribute.

Return type:

bool

abstract property weighting

The weighting schema used by the solver.

Returns:

The weighting schema used by the solver.

Return type:

BaseWeighting

abstract property loss

The element-wise loss module used by the solver.

Returns:

The element-wise loss module used by the solver.

Return type:

torch.nn.Module