GINEConvο
- class dgl.nn.pytorch.conv.GINEConv(apply_func=None, init_eps=0, learn_eps=False)[source]ο
Bases:
Module
Graph Isomorphism Network with Edge Features, introduced by Strategies for Pre-training Graph Neural Networks
where
is the edge feature.- Parameters:
Examples
>>> import dgl >>> import torch >>> import torch.nn as nn >>> from dgl.nn import GINEConv
>>> g = dgl.graph(([0, 1, 2], [1, 1, 3])) >>> in_feats = 10 >>> out_feats = 20 >>> nfeat = torch.randn(g.num_nodes(), in_feats) >>> efeat = torch.randn(g.num_edges(), in_feats) >>> conv = GINEConv(nn.Linear(in_feats, out_feats)) >>> res = conv(g, nfeat, efeat) >>> print(res.shape) torch.Size([4, 20])
- forward(graph, node_feat, edge_feat)[source]ο
Forward computation.
- Parameters:
graph (DGLGraph) β The graph.
node_feat (torch.Tensor or pair of torch.Tensor) β If a torch.Tensor is given, it is the input feature of shape
where is size of input feature, is the number of nodes. If a pair of torch.Tensor is given, the pair must contain two tensors of shape and . Ifapply_func
is not None, should fit the input feature size requirement ofapply_func
.edge_feat (torch.Tensor) β Edge feature. It is a tensor of shape
where is the number of edges.
- Returns:
The output feature of shape
where is the output feature size ofapply_func
. Ifapply_func
is None, should be the same as .- Return type:
torch.Tensor