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","`",")"]
docstr: Unpools a previous edge pooling step.
  
  For unpooling, :obj:`x` should be of same shape as those produced by
  this layer's :func:`forward` function. Then, it will produce an
  unpooled :obj:`x` in addition to :obj:`edge_index` and :obj:`batch`.
  
  Args:
      x (torch.Tensor): The node features.
      unpool_info (UnpoolInfo): Information that has been produced by
          :func:`EdgePooling.forward`.
  
  Return types:
      * **x** *(torch.Tensor)* - The unpooled node features.
      * **edge_index** *(torch.Tensor)* - The new edge indices.
      * **batch** *(torch.Tensor)* - The new batch vector.
docstr_tok: ["Unpools","a","previous","edge","pooling","step",".","For","unpooling",",",":","obj",":","`","x","`","should","be","of","same","shape","as","those","produced","by","this","layer","'s",":","func",":","`","forward","`","function",".","Then",",","it","will","produce","an","unpooled",":","obj",":","`","x","`","in","addition","to",":","obj",":","`","edge_index","`","and",":","obj",":","`","batch","`",".","Args",":","x","(","torch.Tensor",")",":","The","node","features",".","unpool_info","(","UnpoolInfo",")",":","Information","that","has","been","produced","by",":","func",":","`","EdgePooling.forward","`",".","Return","types",":","*","*","*","x","*","*","*","(","torch.Tensor",")","*","-","The","unpooled","node","features",".","*","*","*","edge_index","*","*","*","(","torch.Tensor",")","*","-","The","new","edge","indices",".","*","*","*","batch","*","*","*","(","torch.Tensor",")","*","-","The","new","batch","vector","."]
code: def unpool(
      self,
      x: Tensor,
      unpool_info: UnpoolInfo,
  ) -> Tuple[Tensor, Tensor, Tensor]:
      r"""Unpools a previous edge pooling step.
  
      For unpooling, :obj:`x` should be of same shape as those produced by
      this layer's :func:`forward` function. Then, it will produce an
      unpooled :obj:`x` in addition to :obj:`edge_index` and :obj:`batch`.
  
      Args:
          x (torch.Tensor): The node features.
          unpool_info (UnpoolInfo): Information that has been produced by
              :func:`EdgePooling.forward`.
  
      Return types:
          * **x** *(torch.Tensor)* - The unpooled node features.
          * **edge_index** *(torch.Tensor)* - The new edge indices.
          * **batch** *(torch.Tensor)* - The new batch vector.
      """
      new_x = x / unpool_info.new_edge_score.view(-1, 1)
      new_x = new_x[unpool_info.cluster]
      return new_x, unpool_info.edge_index, unpool_info.batch
  
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 8 for calling the EdgePooling obj's underlying member method code with example usage: obj.unpool(x, unpool_info) and returns: new_x,  unpool_info,  unpool_info