torch_geometric.nn.conv.EdgeConv

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

Bases: MessagePassing

来自“Dynamic Graph CNN for Learning on Point Clouds”论文的边缘卷积操作符。

\[\mathbf{x}^{\prime}_i = \sum_{j \in \mathcal{N}(i)} h_{\mathbf{\Theta}}(\mathbf{x}_i \, \Vert \, \mathbf{x}_j - \mathbf{x}_i),\]

其中 \(h_{\mathbf{\Theta}}\) 表示一个神经网络, 一个多层感知器(MLP)。

Parameters:
  • nn (torch.nn.Module) – 一个神经网络 \(h_{\mathbf{\Theta}}\),它将成对连接的节点特征 x 从形状 [-1, 2 * in_channels] 映射到形状 [-1, out_channels],例如,由 torch.nn.Sequential 定义。

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

  • **kwargs (optional) – Additional arguments of torch_geometric.nn.conv.MessagePassing.

Shapes:
  • 输入: 节点特征 \((|\mathcal{V}|, F_{in})\)\(((|\mathcal{V}|, F_{in}), (|\mathcal{V}|, F_{in}))\) 如果是二分图, 边索引 \((2, |\mathcal{E}|)\)

  • output: node features \((|\mathcal{V}|, F_{out})\) or \((|\mathcal{V}_t|, F_{out})\) if bipartite

forward(x: Union[Tensor, Tuple[Tensor, Tensor]], edge_index: Union[Tensor, SparseTensor]) Tensor[source]

运行模块的前向传播。

Return type:

Tensor

reset_parameters()[source]

重置模块的所有可学习参数。