torch_geometric.nn.models.DeepGCNLayer

class DeepGCNLayer(conv: Optional[Module] = None, norm: Optional[Module] = None, act: Optional[Module] = None, block: str = 'res+', dropout: float = 0.0, ckpt_grad: bool = False)[source]

Bases: Module

来自 “DeepGCNs: Can GCNs Go as Deep as CNNs?”“All You Need to Train Deeper GCNs” 论文的跳跃连接操作。 实现的跳跃连接包括预激活残差 连接 ("res+")、残差连接 ("res")、 密集连接 ("dense") 和无连接 ("plain")。

  • Res+ ("res+"):

\[\text{Normalization}\to\text{Activation}\to\text{Dropout}\to \text{GraphConv}\to\text{Res}\]
  • Res ("res") / Dense ("dense") / Plain ("plain"):

\[\text{GraphConv}\to\text{Normalization}\to\text{Activation}\to \text{Res/Dense/Plain}\to\text{Dropout}\]

注意

For an example of using GENConv, see examples/ogbn_proteins_deepgcn.py.

Parameters:
  • conv (torch.nn.Module, 可选) – GCN操作符。 (默认: None)

  • norm (torch.nn.Module) – 归一化层。(默认值:None

  • act (torch.nn.Module) – 激活层。(默认: None)

  • block (str, 可选) – 要使用的跳跃连接操作 ("res+", "res", "dense""plain"). (默认: "res+")

  • dropout (float, optional) – 是否应用或丢弃。 (默认: 0.)

  • ckpt_grad (bool, optional) – 如果设置为 True,将会对模型的这一部分进行检查点保存。检查点保存通过用计算换取内存来工作,因为不需要将中间激活值保存在内存中。如果你在深入训练时遇到内存不足的错误,请将此设置为 True。(默认值:False

forward(*args, **kwargs) Tensor[source]
Return type:

Tensor

reset_parameters()[source]

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