grb.model.dgl

grb.model.dgl.gat

class grb.model.dgl.gat.GAT(in_features, out_features, hidden_features, num_heads, activation=<function leaky_relu>, layer_norm=False)[source]

Bases: torch.nn.modules.module.Module

forward(x, adj, dropout=0)[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.

property model_type
training: bool

grb.model.dgl.gcn

class grb.model.dgl.gcn.GCN(in_features, out_features, hidden_features, activation=<function relu>, layer_norm=False)[source]

Bases: torch.nn.modules.module.Module

forward(x, adj, dropout=0)[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.

property model_type
training: bool

grb.model.dgl.gin

class grb.model.dgl.gin.ApplyNodeFunc(mlp)[source]

Bases: torch.nn.modules.module.Module

Update the node feature hv with MLP, BN and ReLU.

forward(h)[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.

training: bool
class grb.model.dgl.gin.GIN(in_features, hidden_features, out_features, learn_eps=True, neighbor_pooling_type='sum', num_mlp_layers=1)[source]

Bases: torch.nn.modules.module.Module

GIN model

forward(x, adj, dropout=0)[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.

property model_type
training: bool
class grb.model.dgl.gin.MLP(num_layers, input_dim, hidden_dim, output_dim)[source]

Bases: torch.nn.modules.module.Module

MLP with linear output

forward(x)[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.

training: bool

grb.model.dgl.grand

class grb.model.dgl.grand.GRAND(in_features, hidden_features, out_features, S=1, K=3, node_dropout=0.0, input_droprate=0.0, hidden_droprate=0.0, batchnorm=False)[source]

Bases: torch.nn.modules.module.Module

Parameters
  • in_features (int) – Input feature size. i.e, the number of dimensions of: math: H^{(i)}.

  • hidden_features (int) – Hidden feature size.

  • out_features (int) – Number of classes.

  • S (int) – Number of Augmentation samples

  • K (int) – Number of Propagation Steps

  • node_dropout (float) – Dropout rate on node features.

  • input_dropout (float) – Dropout rate of the input layer of a MLP

  • hidden_dropout (float) – Dropout rate of the hidden layer of a MLPx

  • batchnorm (bool, optional) – If True, use batch normalization.

forward(x, adj, dropout=0, training=True)[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.

property model_type
training: bool
grb.model.dgl.grand.GRANDConv(graph, feats, order)[source]
Parameters
  • graph (dgl.Graph) – The input graph

  • feats (Tensor (n_nodes * feat_dim)) – Node features

  • order (int) – Propagation Steps

class grb.model.dgl.grand.MLP(nfeat, nhid, nclass, input_droprate, hidden_droprate, use_bn=False)[source]

Bases: torch.nn.modules.module.Module

forward(x)[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.

reset_parameters()[source]
training: bool
grb.model.dgl.grand.drop_node(feats, drop_rate, training)[source]