Input Equation Condition#
- class InputEquationCondition(input, equation)[source]#
Bases:
ConditionInterface
The class
InputEquationCondition
defines a condition based oninput
data and anequation
. This condition is typically used in physics-informed problems, where the model is trained to satisfy a givenequation
through the evaluation of the residual performed at the providedinput
.The class automatically selects the appropriate implementation based on the type of the
input
data. Depending on whether theinput
is a tensor or graph-based data, one of the following specialized subclasses is instantiated:InputTensorEquationCondition
: For cases where theinput
data is aLabelTensor
object.InputGraphEquationCondition
: For cases where theinput
data is aGraph
object.
- 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:
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
input
is a list ofGraph
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 whereinput
is aLabelTensor
object.Initialization of the
InputEquationCondition
class.- 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
input
is a list ofGraph
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 whereinput
is aGraph
object.Initialization of the
InputEquationCondition
class.- 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
input
is a list ofGraph
all elements in the list must share the same structure, with matching keys and consistent data types.