Deep Graph Library Backend
Models
-
class
autogl.module.model.dgl.
AutoTopkpool
(num_features=None, num_classes=None, device=None, num_graph_features=0, **args)[source] AutoTopkpool. The model used in this automodel is from https://arxiv.org/abs/1905.05178, https://arxiv.org/abs/1905.02850 :param num_features: The dimension of features. :type num_features: int. :param num_classes: The number of classes. :type num_classes: int. :param device: The device where model will be running on. :type device: torch.device or str :param init: If True(False), the model will (not) be initialized. :type init: bool.
-
class
autogl.module.model.dgl.
GCN
(args)[source] -
forward
(data)[source] Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
-
class
autogl.module.model.dgl.
AutoGCN
(input_dimension: Optional[int] = None, output_dimension: Optional[int] = None, device: Union[str, torch.device] = 'cpu', **kwargs)[source] AutoGCN. The model used in this automodel is GCN, i.e., the graph convolutional network from the “Semi-supervised Classification with Graph Convolutional Networks” paper. The layer is
\[\mathbf{X}^{\prime} = \mathbf{\hat{D}}^{-1/2} \mathbf{\hat{A}} \mathbf{\hat{D}}^{-1/2} \mathbf{X} \mathbf{\Theta},\]where \(\mathbf{\hat{A}} = \mathbf{A} + \mathbf{I}\) denotes the adjacency matrix with inserted self-loops and \(\hat{D}_{ii} = \sum_{j=0} \hat{A}_{ij}\) its diagonal degree matrix.
Parameters: - num_features (
int
) – The dimension of features. - num_classes (
int
) – The number of classes. - device (
torch.device
orstr
) – The device where model will be running on. - init (bool.) – If True(False), the model will (not) be initialized.
- num_features (
-
class
autogl.module.model.dgl.
GraphSAGE
(args)[source] -
forward
(data)[source] Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
-
class
autogl.module.model.dgl.
AutoSAGE
(num_features=None, num_classes=None, device=None, **args)[source] AutoSAGE. The model used in this automodel is GraphSAGE, i.e., the GraphSAGE from the “Inductive Representation Learning on Large Graphs” paper. The layer is
\[\mathbf{x}^{\prime}_i = \mathbf{W}_1 \mathbf{x}_i + \mathbf{W_2} \cdot \mathrm{mean}_{j \in \mathcal{N(i)}} \mathbf{x}_j\]Parameters: - num_features (int.) – The dimension of features.
- num_classes (int.) – The number of classes.
- device (torch.device or str) – The device where model will be running on.
- init (bool.) – If True(False), the model will (not) be initialized.
-
class
autogl.module.model.dgl.
GAT
(args)[source] -
forward
(data)[source] Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
-
class
autogl.module.model.dgl.
AutoGAT
(input_dimension=None, output_dimension=None, device=None, **args)[source] AutoGAT. The model used in this automodel is GAT, i.e., the graph attentional network from the “Graph Attention Networks” paper. The layer is
\[\mathbf{x}^{\prime}_i = \alpha_{i,i}\mathbf{\Theta}\mathbf{x}_{i} + \sum_{j \in \mathcal{N}(i)} \alpha_{i,j}\mathbf{\Theta}\mathbf{x}_{j}\]where the attention coefficients \(\alpha_{i,j}\) are computed as
\[\alpha_{i,j} = \frac{ \exp\left(\mathrm{LeakyReLU}\left(\mathbf{a}^{\top} [\mathbf{\Theta}\mathbf{x}_i \, \Vert \, \mathbf{\Theta}\mathbf{x}_j] \right)\right)} {\sum_{k \in \mathcal{N}(i) \cup \{ i \}} \exp\left(\mathrm{LeakyReLU}\left(\mathbf{a}^{\top} [\mathbf{\Theta}\mathbf{x}_i \, \Vert \, \mathbf{\Theta}\mathbf{x}_k] \right)\right)}.\]Parameters: - num_features (int.) – The dimension of features.
- num_classes (int.) – The number of classes.
- device (torch.device or str) – The device where model will be running on.
- init (bool.) – If True(False), the model will (not) be initialized.
- args (Other parameters.) –
-
class
autogl.module.model.dgl.
AutoGIN
(num_features=None, num_classes=None, device=None, num_graph_features=0, **args)[source] AutoGIN. The model used in this automodel is GIN, i.e., the graph isomorphism network from the “How Powerful are Graph Neural Networks?” paper. The layer is
\[\mathbf{x}^{\prime}_i = h_{\mathbf{\Theta}} \left( (1 + \epsilon) \cdot \mathbf{x}_i + \sum_{j \in \mathcal{N}(i)} \mathbf{x}_j \right)\]or
\[\mathbf{X}^{\prime} = h_{\mathbf{\Theta}} \left( \left( \mathbf{A} + (1 + \epsilon) \cdot \mathbf{I} \right) \cdot \mathbf{X} \right),\]here \(h_{\mathbf{\Theta}}\) denotes a neural network, .i.e. an MLP.
Parameters: - num_features (int.) – The dimension of features.
- num_classes (int.) – The number of classes.
- device (torch.device or str) – The device where model will be running on.
- init (bool.) – If True(False), the model will (not) be initialized.
-
class
autogl.module.model.dgl.
AutoHGT
(num_features=None, num_classes=None, device=None, init=False, dataset=None, **args)[source] AutoHGT. The model used in this automodel is HGT, i.e., the graph convolutional network from the “Heterogeneous Graph Transformer” paper.
Parameters: - num_features (int.) – The dimension of features.
- num_classes (int.) – The number of classes.
- device (torch.device or str.) – The device where model will be running on.
- init (bool.) – If True(False), the model will (not) be initialized.
- dataset (autogl.datasets.) – Hetero Graph Dataset in autogl.
-
class
autogl.module.model.dgl.
AutoHAN
(num_features=None, num_classes=None, device=None, init=False, dataset=None, **args)[source] AutoHAN. The model used in this automodel is HAN, i.e., the graph convolutional network from the “Heterogenous Graph Attention Network” paper.
Parameters: - num_features (int.) – The dimension of features.
- num_classes (int.) – The number of classes.
- device (torch.device or str.) – The device where model will be running on.
- init (bool.) – If True(False), the model will (not) be initialized.
- dataset (autogl.datasets.) – Hetero Graph Dataset in autogl.
-
class
autogl.module.model.dgl.
AutoHeteroRGCN
(num_features=None, num_classes=None, device=None, init=False, dataset=None, **args)[source] AutoHeteroRGCN. The model used in this automodel is HeteroRGCN, i.e., the relational graph convolutional network from the “Modeling Relational Data with Graph Convolutional Networks” paper
Parameters: - num_features (int.) – The dimension of features.
- num_classes (int.) – The number of classes.
- device (torch.device or str.) – The device where model will be running on.
- init (bool.) – If True(False), the model will (not) be initialized.
- dataset (autogl.datasets.) – Hetero Graph Dataset in autogl.