Base Equation#

class BaseEquation[source]#

Bases: object

Base class for all equations, implementing common functionality.

Equations are fundamental components in PINA, representing mathematical constraints that must be satisfied by the model outputs. They can be passed to Condition objects to define the conditions under which the model is trained.

All specific equation types should inherit from this class and implement its abstract methods.

This class is not meant to be instantiated directly.

abstract residual(input_, output_, params_)[source]#

Evaluate the equation residual at the given inputs.

Parameters:
  • input (LabelTensor) – The input points where the residual is computed.

  • output (LabelTensor) – The output tensor, potentially produced by a torch.nn.Module instance.

  • params (dict) – An optional dictionary of unknown parameters, used in InverseProblem settings. If the equation is not related to an inverse problem, this should be set to None. Default is None.

Returns:

The residual values of the equation.

Return type:

LabelTensor

to(device)[source]#

Move all tensor attributes to the specified device.

Parameters:

device (torch.device) – The target device to move the tensors to.

Returns:

The instance moved to the specified device.

Return type:

BaseEquation