pydgn.model
model.dgn
model.readout
model.interface
- class pydgn.model.interface.ModelInterface(*args: Any, **kwargs: Any)
Bases:
torch.nn.Module
Provides the signature for any main model to be trained under PyDGN
- Parameters
dim_node_features (int) – dimension of node features (according to the
DatasetInterface
property)dim_edge_features (int) – dimension of edge features (according to the
DatasetInterface
property)dim_target (int) – dimension of the target (according to the
DatasetInterface
property)readout_class (Callable[…,:class:torch.nn.Module]) – class of the module implementing the readout. This is optional, but useful to put different readouts to try in the config file
config (dict) – config dictionary containing all the necessary hyper-parameters plus additional information (if needed)
- forward(data: torch_geometric.data.Batch) Tuple[torch.Tensor, Optional[torch.Tensor], Optional[List[object]]]
Performs a forward pass over a batch of graphs
- Parameters
data (
torch_geometric.data.Batch
) – a batch of graphs- Returns
a tuple (model’s output, [optional] node embeddings, [optional] additional outputs
- class pydgn.model.interface.ReadoutInterface(*args: Any, **kwargs: Any)
Bases:
torch.nn.Module
Provides the signature for any readout to be trained under PyDGN
- Parameters
dim_node_features (int) – dimension of node features (according to the
DatasetInterface
property)dim_edge_features (int) – dimension of edge features (according to the
DatasetInterface
property)dim_target (int) – dimension of the target (according to the
DatasetInterface
property)config (dict) – config dictionary containing all the necessary hyper-parameters plus additional information (if needed)
- forward(node_embeddings: torch.tensor, batch: torch.Tensor, **kwargs) Tuple[torch.Tensor, Optional[torch.Tensor], Optional[List[object]]]
Performs a forward pass over a batch of graphs
- Parameters
node_embeddings (
torch_geometric.data.Batch
) – the node embeddingsbatch (
torch.Tensor
) – the usualbatch
object of PyGkwargs (dict) – additional and optional arguments
- Returns
a tuple (model’s output, [optional] node embeddings, [optional] additional outputs