torch_geometric.nn.conv.TAGConv

class TAGConv(in_channels: int, out_channels: int, K: int = 3, bias: bool = True, normalize: bool = True, **kwargs)[source]

Bases: MessagePassing

拓扑自适应图卷积网络算子来自 “Topology Adaptive Graph Convolutional Networks” 论文。

\[\mathbf{X}^{\prime} = \sum_{k=0}^K \left( \mathbf{D}^{-1/2} \mathbf{A} \mathbf{D}^{-1/2} \right)^k \mathbf{X} \mathbf{W}_{k},\]

其中 \(\mathbf{A}\) 表示邻接矩阵,\(D_{ii} = \sum_{j=0} A_{ij}\) 表示其对角度矩阵。邻接矩阵可以包含除 1 以外的其他值,通过可选的 edge_weight 张量表示边的权重。

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.

  • K (int, optional) – 跳数 \(K\). (默认: 3)

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

  • normalize (bool, optional) – 是否应用对称归一化。 (default: True)

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

Shapes:
  • 输入: 节点特征 \((|\mathcal{V}|, F_{in})\), 边索引 \((2, |\mathcal{E}|)\), 边权重 \((|\mathcal{E}|)\) (可选)

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

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

运行模块的前向传播。

Return type:

Tensor

reset_parameters()[source]

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