Input Target Condition#
- class InputTargetCondition(input, target)[source]#
Bases:
ConditionInterfaceThe
InputTargetConditionclass represents a supervised condition defined by bothinputandtargetdata. The model is trained to reproduce thetargetvalues given theinput. Supported data types includetorch.Tensor,LabelTensor,Graph, orData.The class automatically selects the appropriate implementation based on the types of
inputandtarget. Depending on whether theinputandtargetare tensors or graph-based data, one of the following specialized subclasses is instantiated:TensorInputTensorTargetCondition: For cases where bothinputandtargetdata are eithertorch.TensororLabelTensor.TensorInputGraphTargetCondition: For cases whereinputis either atorch.TensororLabelTensorandtargetis either aGraphor atorch_geometric.data.Data.GraphInputTensorTargetCondition: For cases whereinputis either aGraphortorch_geometric.data.Dataandtargetis either atorch.Tensoror aLabelTensor.GraphInputGraphTargetCondition: For cases where bothinputandtargetare eitherGraphortorch_geometric.data.Data.
- 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
InputTargetConditionclass.- Parameters:
input (torch.Tensor | LabelTensor | Graph | Data | list[Graph] | list[Data] | tuple[Graph] | tuple[Data]) – The input data for the condition.
target (torch.Tensor | LabelTensor | Graph | Data | list[Graph] | list[Data] | tuple[Graph] | tuple[Data]) – The target data for the condition.
- class TensorInputTensorTargetCondition(input, target)[source]#
Bases:
InputTargetConditionSpecialization of the
InputTargetConditionclass for the case where bothinputandtargetaretorch.TensororLabelTensorobjects.Initialization of the
InputTargetConditionclass.- Parameters:
input (torch.Tensor | LabelTensor | Graph | Data | list[Graph] | list[Data] | tuple[Graph] | tuple[Data]) – The input data for the condition.
target (torch.Tensor | LabelTensor | Graph | Data | list[Graph] | list[Data] | tuple[Graph] | tuple[Data]) – The target data for the condition.
- class TensorInputGraphTargetCondition(input, target)[source]#
Bases:
InputTargetConditionSpecialization of the
InputTargetConditionclass for the case whereinputis either atorch.Tensoror aLabelTensorobject andtargetis either aGraphor atorch_geometric.data.Dataobject.Initialization of the
InputTargetConditionclass.- Parameters:
input (torch.Tensor | LabelTensor | Graph | Data | list[Graph] | list[Data] | tuple[Graph] | tuple[Data]) – The input data for the condition.
target (torch.Tensor | LabelTensor | Graph | Data | list[Graph] | list[Data] | tuple[Graph] | tuple[Data]) – The target data for the condition.
- class GraphInputTensorTargetCondition(input, target)[source]#
Bases:
InputTargetConditionSpecialization of the
InputTargetConditionclass for the case whereinputis either aGraphortorch_geometric.data.Dataobject andtargetis either atorch.Tensoror aLabelTensorobject.Initialization of the
InputTargetConditionclass.- Parameters:
input (torch.Tensor | LabelTensor | Graph | Data | list[Graph] | list[Data] | tuple[Graph] | tuple[Data]) – The input data for the condition.
target (torch.Tensor | LabelTensor | Graph | Data | list[Graph] | list[Data] | tuple[Graph] | tuple[Data]) – The target data for the condition.
- class GraphInputGraphTargetCondition(input, target)[source]#
Bases:
InputTargetConditionSpecialization of the
InputTargetConditionclass for the case where bothinputandtargetare eitherGraphortorch_geometric.data.Dataobjects.Initialization of the
InputTargetConditionclass.- Parameters:
input (torch.Tensor | LabelTensor | Graph | Data | list[Graph] | list[Data] | tuple[Graph] | tuple[Data]) – The input data for the condition.
target (torch.Tensor | LabelTensor | Graph | Data | list[Graph] | list[Data] | tuple[Graph] | tuple[Data]) – The target data for the condition.