Input Equation Condition#

class InputEquationCondition(input, equation)[source]#

Bases: ConditionInterface

The class InputEquationCondition defines a condition based on input data and an equation. This condition is typically used in physics-informed problems, where the model is trained to satisfy a given equation through the evaluation of the residual performed at the provided input.

The class automatically selects the appropriate implementation based on the type of the input data. Depending on whether the input is a tensor or graph-based data, one of the following specialized subclasses is instantiated:

Example:

>>> from pina import Condition, LabelTensor
>>> from pina.equation import Equation
>>> import torch
>>> # Equation to be satisfied over the input points: # x^2 + y^2 - 1 = 0
>>> def dummy_equation(pts):
...     return pts["x"]**2 + pts["y"]**2 - 1
>>> pts = LabelTensor(torch.randn(100, 2), labels=["x", "y"])
>>> condition = Condition(input=pts, equation=Equation(dummy_equation))

Initialization of the InputEquationCondition class.

Parameters:

Note

If input is a list of Graph all elements in the list must share the same structure, with matching keys and consistent data types.

class InputTensorEquationCondition(input, equation)[source]#

Bases: InputEquationCondition

Specialization of the InputEquationCondition class for the case where input is a LabelTensor object.

Initialization of the InputEquationCondition class.

Parameters:

Note

If input is a list of Graph all elements in the list must share the same structure, with matching keys and consistent data types.

class InputGraphEquationCondition(input, equation)[source]#

Bases: InputEquationCondition

Specialization of the InputEquationCondition class for the case where input is a Graph object.

Initialization of the InputEquationCondition class.

Parameters:

Note

If input is a list of Graph all elements in the list must share the same structure, with matching keys and consistent data types.