class_docstr: Selects the top-:math:`k` nodes with highest projection scores from the
  `"Graph U-Nets" <https://arxiv.org/abs/1905.05178>`_, `"Towards Sparse
  Hierarchical Graph Classifiers" <https://arxiv.org/abs/1811.01287>`_
  and `"Understanding Attention and Generalization in Graph Neural
  Networks" <https://arxiv.org/abs/1905.02850>`_ papers.
  
  If :obj:`min_score` :math:`\tilde{\alpha}` is :obj:`None`, computes:
  
      .. math::
          \mathbf{y} &= \sigma \left( \frac{\mathbf{X}\mathbf{p}}{\|
          \mathbf{p} \|} \right)
  
          \mathbf{i} &= \mathrm{top}_k(\mathbf{y})
  
  If :obj:`min_score` :math:`\tilde{\alpha}` is a value in :obj:`[0, 1]`,
  computes:
  
      .. math::
          \mathbf{y} &= \mathrm{softmax}(\mathbf{X}\mathbf{p})
  
          \mathbf{i} &= \mathbf{y}_i > \tilde{\alpha}
  
  where :math:`\mathbf{p}` is the learnable projection vector.
  
  Args:
      in_channels (int): Size of each input sample.
      ratio (float or int): The graph pooling ratio, which is used to compute
          :math:`k = \lceil \mathrm{ratio} \cdot N \rceil`, or the value
          of :math:`k` itself, depending on whether the type of :obj:`ratio`
          is :obj:`float` or :obj:`int`.
          This value is ignored if :obj:`min_score` is not :obj:`None`.
          (default: :obj:`0.5`)
      min_score (float, optional): Minimal node score :math:`\tilde{\alpha}`
          which is used to compute indices of pooled nodes
          :math:`\mathbf{i} = \mathbf{y}_i > \tilde{\alpha}`.
          When this value is not :obj:`None`, the :obj:`ratio` argument is
          ignored. (default: :obj:`None`)
      act (str or callable, optional): The non-linearity :math:`\sigma`.
          (default: :obj:`"tanh"`)
class_docstr_tok: ["Selects","the","top-",":","math",":","`","k","`","nodes","with","highest","projection","scores","from","the","`","``","Graph","U-Nets","''","<","https",":","\/\/arxiv.org\/abs\/1905.05178",">","`","_",",","`","``","Towards","Sparse","Hierarchical","Graph","Classifiers","''","<","https",":","\/\/arxiv.org\/abs\/1811.01287",">","`","_","and","`","``","Understanding","Attention","and","Generalization","in","Graph","Neural","Networks","''","<","https",":","\/\/arxiv.org\/abs\/1905.02850",">","`","_","papers",".","If",":","obj",":","`","min_score","`",":","math",":","`","\\tilde","{","\\alpha","}","`","is",":","obj",":","`","None","`",",","computes",":","..","math",":",":","\\mathbf","{","y","}","&","=","\\sigma","\\left","(","\\frac","{","\\mathbf","{","X","}","\\mathbf","{","p","}","}","{","\\|","\\mathbf","{","p","}","\\|","}","\\right",")","\\mathbf","{","i","}","&","=","\\mathrm","{","top","}","_k","(","\\mathbf","{","y","}",")","If",":","obj",":","`","min_score","`",":","math",":","`","\\tilde","{","\\alpha","}","`","is","a","value","in",":","obj",":","`","[","0",",","1","]","`",",","computes",":","..","math",":",":","\\mathbf","{","y","}","&","=","\\mathrm","{","softmax","}","(","\\mathbf","{","X","}","\\mathbf","{","p","}",")","\\mathbf","{","i","}","&","=","\\mathbf","{","y","}","_i",">","\\tilde","{","\\alpha","}","where",":","math",":","`","\\mathbf","{","p","}","`","is","the","learnable","projection","vector",".","Args",":","in_channels","(","int",")",":","Size","of","each","input","sample",".","ratio","(","float","or","int",")",":","The","graph","pooling","ratio",",","which","is","used","to","compute",":","math",":","`","k","=","\\lceil","\\mathrm","{","ratio","}","\\cdot","N","\\rceil","`",",","or","the","value","of",":","math",":","`","k","`","itself",",","depending","on","whether","the","type","of",":","obj",":","`","ratio","`","is",":","obj",":","`","float","`","or",":","obj",":","`","int","`",".","This","value","is","ignored","if",":","obj",":","`","min_score","`","is","not",":","obj",":","`","None","`",".","(","default",":",":","obj",":","`","0.5","`",")","min_score","(","float",",","optional",")",":","Minimal","node","score",":","math",":","`","\\tilde","{","\\alpha","}","`","which","is","used","to","compute","indices","of","pooled","nodes",":","math",":","`","\\mathbf","{","i","}","=","\\mathbf","{","y","}","_i",">","\\tilde","{","\\alpha","}","`",".","When","this","value","is","not",":","obj",":","`","None","`",",","the",":","obj",":","`","ratio","`","argument","is","ignored",".","(","default",":",":","obj",":","`","None","`",")","act","(","str","or","callable",",","optional",")",":","The","non-linearity",":","math",":","`","\\sigma","`",".","(","default",":",":","obj",":","`","``","tanh","''","`",")"]
code: def reset_parameters(self):
      uniform(self.in_channels, self.weight)
  
file_path: pytorch_geometric/torch_geometric/nn/pool/select/topk.py
imports: from typing import Callable, Optional, Union
  import torch
  from torch import Tensor
  from torch_geometric.nn.inits import uniform
  from torch_geometric.nn.pool.select import Select, SelectOutput
  from torch_geometric.nn.resolver import activation_resolver
  from torch_geometric.utils import cumsum, scatter, softmax
label_desc: Use image node_id 2 for calling the SelectTopK obj's underlying member method code with example usage: obj.reset_parameters() without return types