gammagl.layers.conv.EdgeConv

class EdgeConv(nn, aggr='max', **kwargs)[source]

The Edge Convolution operator from the “Dynamic Graph CNN for Learning on Point Clouds” paper

\[\mathbf{x}^{(k)}_i = \max_{j\in N(i)}h_\Theta(\mathbf x_i^{(k-1)},x_j^{(k-1)}-x_i^{(k-1)})\]

where \(\mathbf{x}^{(k)}_i\) denotes k-th layer’s vector i, and \(h_\Theta\) denotes a multilayer perceptron.

Parameters:
  • nn (tlx.nn.Module) – A neural network \(h_{\mathbf{\Theta}}\) that maps pair-wise concatenated node features x of shape [-1, 2 * in_channels] to shape [-1, out_channels], e.g., defined by tlx.nn.Sequential.

  • aggr (str, optional) – The aggregation scheme to use ("add", "mean", "max"). (default: "sum")

  • **kwargs (optional) – Additional arguments of gammagl.layers.conv.MessagePassing.

forward(x, edge_index)[source]
message(x)[source]

Function that construct message from source nodes to destination nodes.

Parameters:
  • x (tensor) – input node feature.

  • edge_index (tensor) – edges from src to dst.

  • edge_weight (tensor, optional) – weight of each edge.

Returns:

  • tensor – output message

  • Returns – the message matrix, and the shape is [num_edges, message_dim]