class_docstr: A self-attention graph pooling layer from the paper
  
  > [Self-Attention Graph Pooling](https://arxiv.org/abs/1904.08082)<br>
  > Junhyun Lee et al.
  
  **Mode**: single, disjoint.
  
  This layer computes:
  $$
      \y = \textrm{GNN}(\A, \X); \;\;\;\;
      \i = \textrm{rank}(\y, K); \;\;\;\;
      \X' = (\X \odot \textrm{tanh}(\y))_\i; \;\;\;\;
      \A' = \A_{\i, \i}
  $$
  where \(\textrm{rank}(\y, K)\) returns the indices of the top K values of \(\y\) and
  $$
      \textrm{GNN}(\A, \X) = \A \X \W.
  $$
  
  \(K\) is defined for each graph as a fraction of the number of nodes, controlled by
  the `ratio` argument.
  
  The gating operation \(\textrm{tanh}(\y)\) (Cangea et al.) can be replaced with a
  sigmoid (Gao & Ji).
  
  **Input**
  
  - Node features of shape `(n_nodes_in, n_node_features)`;
  - Adjacency matrix of shape `(n_nodes_in, n_nodes_in)`;
  - Graph IDs of shape `(n_nodes, )` (only in disjoint mode);
  
  **Output**
  
  - Reduced node features of shape `(ratio * n_nodes_in, n_node_features)`;
  - Reduced adjacency matrix of shape `(ratio * n_nodes_in, ratio * n_nodes_in)`;
  - Reduced graph IDs of shape `(ratio * n_nodes_in, )` (only in disjoint mode);
  - If `return_selection=True`, the selection mask of shape `(ratio * n_nodes_in, )`.
  - If `return_score=True`, the scoring vector of shape `(n_nodes_in, )`
  
  **Arguments**
  
  - `ratio`: float between 0 and 1, ratio of nodes to keep in each graph;
  - `return_selection`: boolean, whether to return the selection mask;
  - `return_score`: boolean, whether to return the node scoring vector;
  - `sigmoid_gating`: boolean, use a sigmoid activation for gating instead of a
      tanh;
  - `kernel_initializer`: initializer for the weights;
  - `kernel_regularizer`: regularization applied to the weights;
  - `kernel_constraint`: constraint applied to the weights;
code: def __init__(
      self,
      ratio,
      return_selection=False,
      return_score=False,
      sigmoid_gating=False,
      kernel_initializer="glorot_uniform",
      kernel_regularizer=None,
      kernel_constraint=None,
      **kwargs,
  ):
      super().__init__(
          ratio,
          return_selection=return_selection,
          return_score=return_score,
          sigmoid_gating=sigmoid_gating,
          kernel_initializer=kernel_initializer,
          kernel_regularizer=kernel_regularizer,
          kernel_constraint=kernel_constraint,
          **kwargs,
      )
  
imports: import tensorflow
  from tensorflow.keras import backend
  from spektral.layers import ops
  from spektral.layers.pooling.topk_pool import TopKPool
label_desc: Use image node_id 1 to create a new SAGPool object from inherited base classes: TopKPool with example: obj = SAGPool(ratio, return_selection, return_score, sigmoid_gating, kernel_initializer, kernel_regularizer, kernel_constraint)