mindspore_gl.nn.EDGEConv
- class mindspore_gl.nn.EDGEConv(in_feat_size: int, out_feat_size: int, batch_norm: bool, bias=True)[source]
EdgeConv layer. From the paper Dynamic Graph CNN for Learning on Point Clouds .
\[h_i^{(l+1)} = \max_{j \in \mathcal{N}(i)} ( \Theta \cdot (h_j^{(l)} - h_i^{(l)}) + \Phi \cdot h_i^{(l)})\]\(\mathcal{N}(i)\) represents the neighbour node of \(i\). \(\Theta\) and \(\Phi\) represents linear layers.
- Parameters
- Inputs:
x (Tensor): The input node features. The shape is \((N,*)\) where \(N\) is the number of nodes, and \(*\) could be of any shape.
g (Graph): The input graph.
- Outputs:
Tensor, output node features. The shape is \((N, out\_feat\_size)\).
- Raises
- Supported Platforms:
Ascend
GPU
Examples
>>> import mindspore as ms >>> from mindspore_gl.nn import EDGEConv >>> from mindspore_gl import GraphField >>> n_nodes = 4 >>> n_edges = 8 >>> feat_size = 16 >>> src_idx = ms.Tensor([0, 0, 0, 1, 1, 1, 2, 3], ms.int32) >>> dst_idx = ms.Tensor([0, 1, 3, 1, 2, 3, 3, 2], ms.int32) >>> ones = ms.ops.Ones() >>> nodes_feat = ones((n_nodes, feat_size), ms.float32) >>> graph_field = GraphField(src_idx, dst_idx, n_nodes, n_edges) >>> out_size = 4 >>> conv = EDGEConv(feat_size, out_size, batch_norm=True) >>> ret = conv(nodes_feat, *graph_field.get_graph()) >>> print(ret.shape) (4, 4)