Input Equation Condition#
- class InputEquationCondition(input, equation)[source]#
Bases:
ConditionInterfaceThe class
InputEquationConditiondefines a condition based oninputdata and anequation. This condition is typically used in physics-informed problems, where the model is trained to satisfy a givenequationthrough the evaluation of the residual performed at the providedinput.The class automatically selects the appropriate implementation based on the type of the
inputdata. Depending on whether theinputis a tensor or graph-based data, one of the following specialized subclasses is instantiated:InputTensorEquationCondition: For cases where theinputdata is aLabelTensorobject.InputGraphEquationCondition: For cases where theinputdata is aGraphobject.
- 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
InputEquationConditionclass.- Parameters:
input (LabelTensor | Graph | list[Graph] | tuple[Graph]) – The input data for the condition.
equation (EquationInterface) – The equation to be satisfied over the specified input points.
Note
If
inputis a list ofGraphall elements in the list must share the same structure, with matching keys and consistent data types.
- class InputTensorEquationCondition(input, equation)[source]#
Bases:
InputEquationConditionSpecialization of the
InputEquationConditionclass for the case whereinputis aLabelTensorobject.Initialization of the
InputEquationConditionclass.- Parameters:
input (LabelTensor | Graph | list[Graph] | tuple[Graph]) – The input data for the condition.
equation (EquationInterface) – The equation to be satisfied over the specified input points.
Note
If
inputis a list ofGraphall elements in the list must share the same structure, with matching keys and consistent data types.
- class InputGraphEquationCondition(input, equation)[source]#
Bases:
InputEquationConditionSpecialization of the
InputEquationConditionclass for the case whereinputis aGraphobject.Initialization of the
InputEquationConditionclass.- Parameters:
input (LabelTensor | Graph | list[Graph] | tuple[Graph]) – The input data for the condition.
equation (EquationInterface) – The equation to be satisfied over the specified input points.
Note
If
inputis a list ofGraphall elements in the list must share the same structure, with matching keys and consistent data types.