torch_geometric.nn.conv.WLConv

class WLConv[source]

Bases: Module

来自“将图简化为规范形式及其过程中产生的代数”论文的Weisfeiler Lehman (WL)算子。

WLConv 根据以下内容迭代地优化节点着色:

\[\mathbf{x}^{\prime}_i = \textrm{hash} \left( \mathbf{x}_i, \{ \mathbf{x}_j \colon j \in \mathcal{N}(i) \} \right)\]
Shapes:
  • 输入: 节点着色 \((|\mathcal{V}|, F_{in})\) (独热编码)\((|\mathcal{V}|)\) (基于整数的), 边索引 \((2, |\mathcal{E}|)\)

  • 输出: 节点着色 \((|\mathcal{V}|)\) (基于整数)

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

运行模块的前向传播。

Return type:

Tensor

reset_parameters()[source]

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

histogram(x: Tensor, batch: Optional[Tensor] = None, norm: bool = False) Tensor[source]

给定一个节点着色 x,计算相应图的颜色直方图(按 batch 分隔)。

Return type:

Tensor