torch_geometric.nn.conv.GINEConv

class GINEConv(nn: Module, eps: float = 0.0, train_eps: bool = False, edge_dim: Optional[int] = None, **kwargs)[source]

Bases: MessagePassing

修改后的GINConv操作符来自“预训练图神经网络的策略”论文。

\[\mathbf{x}^{\prime}_i = h_{\mathbf{\Theta}} \left( (1 + \epsilon) \cdot \mathbf{x}_i + \sum_{j \in \mathcal{N}(i)} \mathrm{ReLU} ( \mathbf{x}_j + \mathbf{e}_{j,i} ) \right)\]

能够将边缘特征 \(\mathbf{e}_{j,i}\) 整合到聚合过程中。

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

  • eps (float, optional) – (初始) \(\epsilon\)-值。 (默认: 0.)

  • train_eps (bool, 可选) – 如果设置为 True, \(\epsilon\) 将是一个可训练的参数。(默认: False)

  • edge_dim (int, optional) – 边的特征维度。如果设置为 None,节点和边的特征维度应匹配。否则,边的特征将通过线性变换以匹配 节点的特征维度。(默认值:None

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

Shapes:
  • input: node features \((|\mathcal{V}|, F_{in})\) or \(((|\mathcal{V_s}|, F_{s}), (|\mathcal{V_t}|, F_{t}))\) if bipartite, edge indices \((2, |\mathcal{E}|)\), edge features \((|\mathcal{E}|, D)\) (optional)

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

forward(x: Union[Tensor, Tuple[Tensor, Optional[Tensor]]], edge_index: Union[Tensor, SparseTensor], edge_attr: Optional[Tensor] = None, size: Optional[Tuple[int, int]] = None) Tensor[source]

运行模块的前向传播。

Return type:

Tensor

reset_parameters()[source]

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