torch_geometric.nn.norm.MessageNorm
- class MessageNorm(learn_scale: bool = False)[source]
Bases:
Module应用消息归一化于聚合消息,如“DeeperGCNs: All You Need to Train Deeper GCNs”论文中所述。
\[\mathbf{x}_i^{\prime} = \mathrm{MLP} \left( \mathbf{x}_{i} + s \cdot {\| \mathbf{x}_i \|}_2 \cdot \frac{\mathbf{m}_{i}}{{\|\mathbf{m}_i\|}_2} \right)\]- forward(x: Tensor, msg: Tensor, p: float = 2.0) Tensor[source]
前向传播。
- Parameters:
x (torch.Tensor) – The source tensor.
msg (torch.Tensor) – 消息张量 \(\mathbf{M}\).
p (float, optional) – 用于归一化的范数 \(p\)。 (默认值:
2.0)
- Return type: