torch_geometric.nn.conv.MixHopConv

class MixHopConv(in_channels: int, out_channels: int, powers: Optional[List[int]] = None, add_self_loops: bool = True, bias: bool = True, **kwargs)[source]

Bases: MessagePassing

来自“MixHop: Higher-Order Graph Convolutional Architectures via Sparsified Neighborhood Mixing”论文的Mix-Hop图卷积操作符。

\[\mathbf{X}^{\prime}={\Bigg\Vert}_{p\in P} {\left( \mathbf{\hat{D}}^{-1/2} \mathbf{\hat{A}} \mathbf{\hat{D}}^{-1/2} \right)}^p \mathbf{X} \mathbf{\Theta},\]

其中 \(\mathbf{\hat{A}} = \mathbf{A} + \mathbf{I}\) 表示插入自环的邻接矩阵,而 \(\hat{D}_{ii} = \sum_{j=0} \hat{A}_{ij}\) 是其对角度矩阵。

Parameters:
  • in_channels (int) – Size of each input sample, or -1 to derive the size from the first input(s) to the forward method.

  • out_channels (int) – Size of each output sample.

  • powers (List[int], optional) – 要使用的邻接矩阵的幂次。(默认值:[0, 1, 2]

  • add_self_loops (bool, optional) – If set to False, will not add self-loops to the input graph. (default: True)

  • bias (bool, optional) – If set to False, the layer will not learn an additive bias. (default: True)

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

Shapes:
  • input: node features \((|\mathcal{V}|, F_{in})\), edge indices \((2, |\mathcal{E}|)\), edge weights \((|\mathcal{E}|)\) (optional)

  • 输出: 节点特征 \((|\mathcal{V}|, |P| \cdot F_{out})\)

forward(x: Tensor, edge_index: Union[Tensor, SparseTensor], edge_weight: Optional[Tensor] = None) Tensor[source]

运行模块的前向传播。

Return type:

Tensor

reset_parameters()[source]

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