torch_geometric.nn.pool.global_max_pool

global_max_pool(x: Tensor, batch: Optional[Tensor], size: Optional[int] = None) Tensor[source]

通过跨节点维度的通道方向最大值返回批次级别的图级输出。

For a single graph \(\mathcal{G}_i\), its output is computed by

\[\mathbf{r}_i = \mathrm{max}_{n=1}^{N_i} \, \mathbf{x}_n.\]

MaxAggregation 模块的功能方法。

Parameters:
  • x (torch.Tensor) – Node feature matrix \(\mathbf{X} \in \mathbb{R}^{(N_1 + \ldots + N_B) \times F}\).

  • batch (torch.Tensor, optional) – 批次向量 \(\mathbf{b} \in {\{ 0, \ldots, B-1\}}^N\), 它将 每个元素分配给特定的示例。

  • size (int, optional) – The number of examples \(B\). Automatically calculated if not given. (default: None)

Return type:

Tensor