Input Target Condition#

class InputTargetCondition(input, target)[source]#

Bases: ConditionInterface

The InputTargetCondition class represents a supervised condition defined by both input and target data. The model is trained to reproduce the target values given the input. Supported data types include torch.Tensor, LabelTensor, Graph, or Data.

The class automatically selects the appropriate implementation based on the types of input and target. Depending on whether the input and target are tensors or graph-based data, one of the following specialized subclasses is instantiated:

Example:

>>> from pina import Condition, LabelTensor
>>> from pina.graph import Graph
>>> import torch
>>> pos = LabelTensor(torch.randn(100, 2), labels=["x", "y"])
>>> edge_index = torch.randint(0, 100, (2, 300))
>>> graph = Graph(pos=pos, edge_index=edge_index)
>>> input = LabelTensor(torch.randn(100, 2), labels=["x", "y"])
>>> condition = Condition(input=input, target=graph)

Initialization of the InputTargetCondition class.

Parameters:

Note

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

class TensorInputTensorTargetCondition(input, target)[source]#

Bases: InputTargetCondition

Specialization of the InputTargetCondition class for the case where both input and target are torch.Tensor or LabelTensor objects.

Initialization of the InputTargetCondition class.

Parameters:

Note

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

class TensorInputGraphTargetCondition(input, target)[source]#

Bases: InputTargetCondition

Specialization of the InputTargetCondition class for the case where input is either a torch.Tensor or a LabelTensor object and target is either a Graph or a torch_geometric.data.Data object.

Initialization of the InputTargetCondition class.

Parameters:

Note

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

class GraphInputTensorTargetCondition(input, target)[source]#

Bases: InputTargetCondition

Specialization of the InputTargetCondition class for the case where input is either a Graph or torch_geometric.data.Data object and target is either a torch.Tensor or a LabelTensor object.

Initialization of the InputTargetCondition class.

Parameters:

Note

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

class GraphInputGraphTargetCondition(input, target)[source]#

Bases: InputTargetCondition

Specialization of the InputTargetCondition class for the case where both input and target are either Graph or torch_geometric.data.Data objects.

Initialization of the InputTargetCondition class.

Parameters:

Note

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