class_docstr: The edge pooling operator from the `"Towards Graph Pooling by Edge
  Contraction" <https://graphreason.github.io/papers/17.pdf>`__ and
  `"Edge Contraction Pooling for Graph Neural Networks"
  <https://arxiv.org/abs/1905.10990>`__ papers.
  
  In short, a score is computed for each edge.
  Edges are contracted iteratively according to that score unless one of
  their nodes has already been part of a contracted edge.
  
  To duplicate the configuration from the `"Towards Graph Pooling by Edge
  Contraction" <https://graphreason.github.io/papers/17.pdf>`__ paper, use
  either :func:`EdgePooling.compute_edge_score_softmax`
  or :func:`EdgePooling.compute_edge_score_tanh`, and set
  :obj:`add_to_edge_score` to :obj:`0.0`.
  
  To duplicate the configuration from the `"Edge Contraction Pooling for
  Graph Neural Networks" <https://arxiv.org/abs/1905.10990>`__ paper,
  set :obj:`dropout` to :obj:`0.2`.
  
  Args:
      in_channels (int): Size of each input sample.
      edge_score_method (callable, optional): The function to apply
          to compute the edge score from raw edge scores. By default,
          this is the softmax over all incoming edges for each node.
          This function takes in a :obj:`raw_edge_score` tensor of shape
          :obj:`[num_nodes]`, an :obj:`edge_index` tensor and the number of
          nodes :obj:`num_nodes`, and produces a new tensor of the same size
          as :obj:`raw_edge_score` describing normalized edge scores.
          Included functions are
          :func:`EdgePooling.compute_edge_score_softmax`,
          :func:`EdgePooling.compute_edge_score_tanh`, and
          :func:`EdgePooling.compute_edge_score_sigmoid`.
          (default: :func:`EdgePooling.compute_edge_score_softmax`)
      dropout (float, optional): The probability with
          which to drop edge scores during training. (default: :obj:`0.0`)
      add_to_edge_score (float, optional): A value to be added to each
          computed edge score. Adding this greatly helps with unpooling
          stability. (default: :obj:`0.5`)
class_docstr_tok: ["The","edge","pooling","operator","from","the","`","``","Towards","Graph","Pooling","by","Edge","Contraction","''","<","https",":","\/\/graphreason.github.io\/papers\/17.pdf",">","`","__","and","`","``","Edge","Contraction","Pooling","for","Graph","Neural","Networks","''","<","https",":","\/\/arxiv.org\/abs\/1905.10990",">","`","__","papers",".","In","short",",","a","score","is","computed","for","each","edge",".","Edges","are","contracted","iteratively","according","to","that","score","unless","one","of","their","nodes","has","already","been","part","of","a","contracted","edge",".","To","duplicate","the","configuration","from","the","`","``","Towards","Graph","Pooling","by","Edge","Contraction","''","<","https",":","\/\/graphreason.github.io\/papers\/17.pdf",">","`","__","paper",",","use","either",":","func",":","`","EdgePooling.compute_edge_score_softmax","`","or",":","func",":","`","EdgePooling.compute_edge_score_tanh","`",",","and","set",":","obj",":","`","add_to_edge_score","`","to",":","obj",":","`","0.0","`",".","To","duplicate","the","configuration","from","the","`","``","Edge","Contraction","Pooling","for","Graph","Neural","Networks","''","<","https",":","\/\/arxiv.org\/abs\/1905.10990",">","`","__","paper",",","set",":","obj",":","`","dropout","`","to",":","obj",":","`","0.2","`",".","Args",":","in_channels","(","int",")",":","Size","of","each","input","sample",".","edge_score_method","(","callable",",","optional",")",":","The","function","to","apply","to","compute","the","edge","score","from","raw","edge","scores",".","By","default",",","this","is","the","softmax","over","all","incoming","edges","for","each","node",".","This","function","takes","in","a",":","obj",":","`","raw_edge_score","`","tensor","of","shape",":","obj",":","`","[","num_nodes","]","`",",","an",":","obj",":","`","edge_index","`","tensor","and","the","number","of","nodes",":","obj",":","`","num_nodes","`",",","and","produces","a","new","tensor","of","the","same","size","as",":","obj",":","`","raw_edge_score","`","describing","normalized","edge","scores",".","Included","functions","are",":","func",":","`","EdgePooling.compute_edge_score_softmax","`",",",":","func",":","`","EdgePooling.compute_edge_score_tanh","`",",","and",":","func",":","`","EdgePooling.compute_edge_score_sigmoid","`",".","(","default",":",":","func",":","`","EdgePooling.compute_edge_score_softmax","`",")","dropout","(","float",",","optional",")",":","The","probability","with","which","to","drop","edge","scores","during","training",".","(","default",":",":","obj",":","`","0.0","`",")","add_to_edge_score","(","float",",","optional",")",":","A","value","to","be","added","to","each","computed","edge","score",".","Adding","this","greatly","helps","with","unpooling","stability",".","(","default",":",":","obj",":","`","0.5","`",")"]
code: def __init__(
      self,
      in_channels: int,
      edge_score_method: Optional[Callable] = None,
      dropout: Optional[float] = 0.0,
      add_to_edge_score: float = 0.5,
  ):
      super().__init__()
      self.in_channels = in_channels
      if edge_score_method is None:
          edge_score_method = self.compute_edge_score_softmax
      self.compute_edge_score = edge_score_method
      self.add_to_edge_score = add_to_edge_score
      self.dropout = dropout
  
      self.lin = torch.nn.Linear(2 * in_channels, 1)
  
      self.reset_parameters()
  
file_path: pytorch_geometric/torch_geometric/nn/pool/edge_pool.py
imports: from typing import Callable, List, NamedTuple, Optional, Tuple
  import torch
  import torch.nn.functional
  from torch import Tensor
  from torch_geometric.utils import coalesce, scatter, softmax
label_desc: Use image node_id 1 to create a new EdgePooling object from inherited base classes: torch.nn with example: obj = EdgePooling(in_channels, edge_score_method, dropout, add_to_edge_score)