torch_geometric.nn.aggr.VariancePreservingAggregation
- class VariancePreservingAggregation[source]
Bases:
Aggregation执行来自“GNN-VPA: 图神经网络的方差保持聚合策略”论文的方差保持聚合(VPA)。
\[\mathrm{vpa}(\mathcal{X}) = \frac{1}{\sqrt{|\mathcal{X}|}} \sum_{\mathbf{x}_i \in \mathcal{X}} \mathbf{x}_i\]- forward(x: Tensor, index: Optional[Tensor] = None, ptr: Optional[Tensor] = None, dim_size: Optional[int] = None, dim: int = -2) Tensor[source]
前向传播。
- Parameters:
x (torch.Tensor) – The source tensor.
index (torch.Tensor, optional) – The indices of elements for applying the aggregation. One of
indexorptrmust be defined. (default:None)ptr (torch.Tensor, optional) – If given, computes the aggregation based on sorted inputs in CSR representation. One of
indexorptrmust be defined. (default:None)dim_size (int, optional) – The size of the output tensor at dimension
dimafter aggregation. (default:None)dim (int, optional) – The dimension in which to aggregate. (default:
-2)max_num_elements – (int, optional): The maximum number of elements within a single aggregation group. (default:
None)
- Return type: