Physics-Informed Mixin#

Module for the physics-informed mixin class.

class PhysicsInformedMixin[source]

Bases: object

Mixin that enables physics-informed training by ensuring gradients are enabled during validation and testing, which is necessary for computing physics residuals.

Designed to be used in combination with any solver inheriting from BaseSolver.

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

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