class_docstr: Implementation of Graph Pooling "SAGPool"
      
  Reference Paper: Self-Attention Graph Pooling
  
  Args:
      input_dim: The size of the inputs.
      ratio: The ratio to reserve topk nodes.
      GNN: Graph Convolution Operation to generate score for every node. Default:None
      min_score: if min_score is not None, the operator only remove 
                          the node with value lower than min_score. Default:None
      nonlinearity: a nonlinear transform on score when min_score is not None. Default:None 
class_docstr_tok: ["Implementation","of","Graph","Pooling","``","SAGPool","''","Reference","Paper",":","Self-Attention","Graph","Pooling","Args",":","input_dim",":","The","size","of","the","inputs",".","ratio",":","The","ratio","to","reserve","topk","nodes",".","GNN",":","Graph","Convolution","Operation","to","generate","score","for","every","node",".","Default",":","None","min_score",":","if","min_score","is","not","None",",","the","operator","only","remove","the","node","with","value","lower","than","min_score",".","Default",":","None","nonlinearity",":","a","nonlinear","transform","on","score","when","min_score","is","not","None",".","Default",":","None"]
code: def __init__(
      self,
      input_dim,
      ratio=0.5,
      gnn=None,
      min_score=None,
      nonlinearity=None,
  ):
      super(SAGPool, self).__init__()
      self.input_dim = input_dim
      self.ratio = ratio
      GNN = GCNConv if gnn is None else gnn
      self.gnn = GNN(input_dim, 1)
      self.min_score = min_score
      self.nonlinearity = (
          paddle.tanh if nonlinearity is None else nonlinearity
      )
  
imports: import warnings
  import numpy
  import paddle
  import paddle.nn
  import paddle.nn.functional
  import pgl
  from pgl.math import segment_sum, segment_softmax, segment_topk, segment_pool
  from pgl.utils.transform import filter_adj
label_desc: Use image node_id 1 to create a new SAGPool object from inherited base classes: nn with example: obj = SAGPool(input_dim, ratio, gnn, min_score, nonlinearity)