torch_geometric.nn.norm.GraphNorm
- class GraphNorm(in_channels: int, eps: float = 1e-05)[source]
Bases:
Module对单个图应用图归一化,如“GraphNorm: A Principled Approach to Accelerating Graph Neural Network Training”论文中所述。
\[\mathbf{x}^{\prime}_i = \frac{\mathbf{x} - \alpha \odot \textrm{E}[\mathbf{x}]} {\sqrt{\textrm{Var}[\mathbf{x} - \alpha \odot \textrm{E}[\mathbf{x}]] + \epsilon}} \odot \gamma + \beta\]其中 \(\alpha\) 表示学习在平均值中保留多少信息的参数。
- Parameters:
- forward(x: Tensor, batch: Optional[Tensor] = None, batch_size: Optional[int] = None) Tensor[source]
前向传播。
- Parameters:
x (torch.Tensor) – The source tensor.
batch (torch.Tensor, optional) – The batch vector \(\mathbf{b} \in {\{ 0, \ldots, B-1\}}^N\), which assigns each element to a specific example. (default:
None)batch_size (int, optional) – The number of examples \(B\). Automatically calculated if not given. (default:
None)
- Return type: