class_docstr: Aggregation layer for message passing withing GNN.
  
  :param aggregate: The aggregation function to use (max, mean, sum).
  :param pooling_mask: Multiplicative pooling mask for efficient aggregation computation.
docstr: Prepare edge list from pooling mask (e.g. for use in scatter reduction).
  
  :param pooling_mask: The pooling mask to convert into edges.
  :return: Edge matrix corresponding to the pooling mask.
docstr_tok: ["Prepare","edge","list","from","pooling","mask","(","e.g",".","for","use","in","scatter","reduction",")",".",":","param","pooling_mask",":","The","pooling","mask","to","convert","into","edges",".",":","return",":","Edge","matrix","corresponding","to","the","pooling","mask","."]
code: def _edges_from_pooling_mask(
      cls, pooling_mask: torch.Tensor
  ) -> torch.Tensor:
      """Prepare edge list from pooling mask (e.g. for use in scatter reduction).
  
      :param pooling_mask: The pooling mask to convert into edges.
      :return: Edge matrix corresponding to the pooling mask.
      """
      pm = pooling_mask.squeeze().cpu().numpy()
  
      edges = []
  
      for i in range(pm.shape[0]):
          for j in np.nonzero(~np.isnan(pm[i]))[0]:
              edges.append([i, j])
  
      edges = np.vstack(edges).T
      return torch.from_numpy(edges)
  
imports: from typing import Any, List, Tuple, Union, Sequence, Dict
  import numpy
  import torch
  from torch import nn
  from torch_scatter import scatter
  from maze.core.annotations import override
  from maze.core.utils.factory import Factory
  from maze.perception.blocks.shape_normalization import ShapeNormalizationBlock
label_desc: Use image node_id 3 for calling the AggregationLayer obj's underlying member method code with example usage: obj._edges_from_pooling_mask(cls, pooling_mask) and returns: torch