class_docstr: The GENeralized Graph Convolution (GENConv) from the `"DeeperGCN: All
  You Need to Train Deeper GCNs" <https://arxiv.org/abs/2006.07739>`_ paper.
  
  :class:`GENConv` supports both :math:`\textrm{softmax}` and
  :math:`textrm{powermean}` aggregation.
  Its message construction is given by:
  
  .. math::
      \mathbf{x}_i^{\prime} = \mathrm{MLP} \left( \mathbf{x}_i +
      \mathrm{AGG} \left( \left\{
      \mathrm{ReLU} \left( \mathbf{x}_j + \mathbf{e_{ji}} \right) +\epsilon
      : j \in \mathcal{N}(i) \right\} \right)
      \right)
  
  .. note::
  
      For an example of using :obj:`GENConv`, see
      `examples/ogbn_proteins_deepgcn.py
      <https://github.com/pyg-team/pytorch_geometric/blob/master/examples/
      ogbn_proteins_deepgcn.py>`_.
  
  Args:
      in_channels (int or tuple): Size of each input sample, or :obj:`-1` to
          derive the size from the first input(s) to the forward method.
          A tuple corresponds to the sizes of source and target
          dimensionalities.
      out_channels (int): Size of each output sample.
      aggr (str or Aggregation, optional): The aggregation scheme to use.
          Any aggregation of :obj:`torch_geometric.nn.aggr` can be used,
          (:obj:`"softmax"`, :obj:`"powermean"`, :obj:`"add"`, :obj:`"mean"`,
          :obj:`max`). (default: :obj:`"softmax"`)
      t (float, optional): Initial inverse temperature for softmax
          aggregation. (default: :obj:`1.0`)
      learn_t (bool, optional): If set to :obj:`True`, will learn the value
          :obj:`t` for softmax aggregation dynamically.
          (default: :obj:`False`)
      p (float, optional): Initial power for power mean aggregation.
          (default: :obj:`1.0`)
      learn_p (bool, optional): If set to :obj:`True`, will learn the value
          :obj:`p` for power mean aggregation dynamically.
          (default: :obj:`False`)
      msg_norm (bool, optional): If set to :obj:`True`, will use message
          normalization. (default: :obj:`False`)
      learn_msg_scale (bool, optional): If set to :obj:`True`, will learn the
          scaling factor of message normalization. (default: :obj:`False`)
      norm (str, optional): Norm layer of MLP layers (:obj:`"batch"`,
          :obj:`"layer"`, :obj:`"instance"`) (default: :obj:`batch`)
      num_layers (int, optional): The number of MLP layers.
          (default: :obj:`2`)
      expansion (int, optional): The expansion factor of hidden channels in
          MLP layers. (default: :obj:`2`)
      eps (float, optional): The epsilon value of the message construction
          function. (default: :obj:`1e-7`)
      bias (bool, optional): If set to :obj:`False`, the layer will not learn
          an additive bias. (default: :obj:`True`)
      edge_dim (int, optional): Edge feature dimensionality. If set to
          :obj:`None`, Edge feature dimensionality is expected to match
          the `out_channels`. Other-wise, edge features are linearly
          transformed to match `out_channels` of node feature dimensionality.
          (default: :obj:`None`)
      **kwargs (optional): Additional arguments of
          :class:`torch_geometric.nn.conv.GenMessagePassing`.
  
  Shapes:
      - **input:**
        node features :math:`(|\mathcal{V}|, F_{in})` or
        :math:`((|\mathcal{V_s}|, F_{s}), (|\mathcal{V_t}|, F_{t}))`
        if bipartite,
        edge indices :math:`(2, |\mathcal{E}|)`,
        edge attributes :math:`(|\mathcal{E}|, D)` *(optional)*
      - **output:** node features :math:`(|\mathcal{V}|, F_{out})` or
        :math:`(|\mathcal{V}_t|, F_{out})` if bipartite
class_docstr_tok: ["The","GENeralized","Graph","Convolution","(","GENConv",")","from","the","`","``","DeeperGCN",":","All","You","Need","to","Train","Deeper","GCNs","''","<","https",":","\/\/arxiv.org\/abs\/2006.07739",">","`","_","paper",".",":","class",":","`","GENConv","`","supports","both",":","math",":","`","\\textrm","{","softmax","}","`","and",":","math",":","`","textrm","{","powermean","}","`","aggregation",".","Its","message","construction","is","given","by",":","..","math",":",":","\\mathbf","{","x","}","_i^","{","\\prime","}","=","\\mathrm","{","MLP","}","\\left","(","\\mathbf","{","x","}","_i","+","\\mathrm","{","AGG","}","\\left","(","\\left\\","{","\\mathrm","{","ReLU","}","\\left","(","\\mathbf","{","x","}","_j","+","\\mathbf","{","e_","{","ji","}","}","\\right",")","+\\epsilon",":","j","\\in","\\mathcal","{","N","}","(","i",")","\\right\\","}","\\right",")","\\right",")","..","note",":",":","For","an","example","of","using",":","obj",":","`","GENConv","`",",","see","`","examples\/ogbn_proteins_deepgcn.py","<","https",":","\/\/github.com\/pyg-team\/pytorch_geometric\/blob\/master\/examples\/","ogbn_proteins_deepgcn.py",">","`","_",".","Args",":","in_channels","(","int","or","tuple",")",":","Size","of","each","input","sample",",","or",":","obj",":","`","-1","`","to","derive","the","size","from","the","first","input","(","s",")","to","the","forward","method",".","A","tuple","corresponds","to","the","sizes","of","source","and","target","dimensionalities",".","out_channels","(","int",")",":","Size","of","each","output","sample",".","aggr","(","str","or","Aggregation",",","optional",")",":","The","aggregation","scheme","to","use",".","Any","aggregation","of",":","obj",":","`","torch_geometric.nn.aggr","`","can","be","used",",","(",":","obj",":","`","``","softmax","''","`",",",":","obj",":","`","``","powermean","''","`",",",":","obj",":","`","``","add","''","`",",",":","obj",":","`","``","mean","''","`",",",":","obj",":","`","max","`",")",".","(","default",":",":","obj",":","`","``","softmax","''","`",")","t","(","float",",","optional",")",":","Initial","inverse","temperature","for","softmax","aggregation",".","(","default",":",":","obj",":","`","1.0","`",")","learn_t","(","bool",",","optional",")",":","If","set","to",":","obj",":","`","True","`",",","will","learn","the","value",":","obj",":","`","t","`","for","softmax","aggregation","dynamically",".","(","default",":",":","obj",":","`","False","`",")","p","(","float",",","optional",")",":","Initial","power","for","power","mean","aggregation",".","(","default",":",":","obj",":","`","1.0","`",")","learn_p","(","bool",",","optional",")",":","If","set","to",":","obj",":","`","True","`",",","will","learn","the","value",":","obj",":","`","p","`","for","power","mean","aggregation","dynamically",".","(","default",":",":","obj",":","`","False","`",")","msg_norm","(","bool",",","optional",")",":","If","set","to",":","obj",":","`","True","`",",","will","use","message","normalization",".","(","default",":",":","obj",":","`","False","`",")","learn_msg_scale","(","bool",",","optional",")",":","If","set","to",":","obj",":","`","True","`",",","will","learn","the","scaling","factor","of","message","normalization",".","(","default",":",":","obj",":","`","False","`",")","norm","(","str",",","optional",")",":","Norm","layer","of","MLP","layers","(",":","obj",":","`","``","batch","''","`",",",":","obj",":","`","``","layer","''","`",",",":","obj",":","`","``","instance","''","`",")","(","default",":",":","obj",":","`","batch","`",")","num_layers","(","int",",","optional",")",":","The","number","of","MLP","layers",".","(","default",":",":","obj",":","`","2","`",")","expansion","(","int",",","optional",")",":","The","expansion","factor","of","hidden","channels","in","MLP","layers",".","(","default",":",":","obj",":","`","2","`",")","eps","(","float",",","optional",")",":","The","epsilon","value","of","the","message","construction","function",".","(","default",":",":","obj",":","`","1e-7","`",")","bias","(","bool",",","optional",")",":","If","set","to",":","obj",":","`","False","`",",","the","layer","will","not","learn","an","additive","bias",".","(","default",":",":","obj",":","`","True","`",")","edge_dim","(","int",",","optional",")",":","Edge","feature","dimensionality",".","If","set","to",":","obj",":","`","None","`",",","Edge","feature","dimensionality","is","expected","to","match","the","`","out_channels","`",".","Other-wise",",","edge","features","are","linearly","transformed","to","match","`","out_channels","`","of","node","feature","dimensionality",".","(","default",":",":","obj",":","`","None","`",")","*","*","kwargs","(","optional",")",":","Additional","arguments","of",":","class",":","`","torch_geometric.nn.conv.GenMessagePassing","`",".","Shapes",":","-","*","*","input",":","*","*","node","features",":","math",":","`","(","|\\mathcal","{","V","}","|",",","F_","{","in","}",")","`","or",":","math",":","`","(","(","|\\mathcal","{","V_s","}","|",",","F_","{","s","}",")",",","(","|\\mathcal","{","V_t","}","|",",","F_","{","t","}",")",")","`","if","bipartite",",","edge","indices",":","math",":","`","(","2",",","|\\mathcal","{","E","}","|",")","`",",","edge","attributes",":","math",":","`","(","|\\mathcal","{","E","}","|",",","D",")","`","*","(","optional",")","*","-","*","*","output",":","*","*","node","features",":","math",":","`","(","|\\mathcal","{","V","}","|",",","F_","{","out","}",")","`","or",":","math",":","`","(","|\\mathcal","{","V","}","_t|",",","F_","{","out","}",")","`","if","bipartite"]
code: def forward(
      self,
      x: Union[Tensor, OptPairTensor],
      edge_index: Adj,
      edge_attr: OptTensor = None,
      size: Size = None,
  ) -> Tensor:
      if isinstance(x, Tensor):
          x = (x, x)
  
      if hasattr(self, "lin_src"):
          x = (self.lin_src(x[0]), x[1])
  
      if isinstance(edge_index, SparseTensor):
          edge_attr = edge_index.storage.value()
      elif is_torch_sparse_tensor(edge_index):
          _, value = to_edge_index(edge_index)
          if value.dim() > 1 or not value.all():
              edge_attr = value
  
      if edge_attr is not None and hasattr(self, "lin_edge"):
          edge_attr = self.lin_edge(edge_attr)
  
      # Node and edge feature dimensionalites need to match.
      if edge_attr is not None:
          assert x[0].size(-1) == edge_attr.size(-1)
  
      # propagate_type: (x: OptPairTensor, edge_attr: OptTensor)
      out = self.propagate(
          edge_index, x=x, edge_attr=edge_attr, size=size
      )
  
      if hasattr(self, "lin_aggr_out"):
          out = self.lin_aggr_out(out)
  
      if hasattr(self, "msg_norm"):
          h = x[1] if x[1] is not None else x[0]
          assert h is not None
          out = self.msg_norm(h, out)
  
      x_dst = x[1]
      if x_dst is not None:
          if hasattr(self, "lin_dst"):
              x_dst = self.lin_dst(x_dst)
          out = out + x_dst
  
      return self.mlp(out)
  
file_path: pytorch_geometric/torch_geometric/nn/conv/gen_conv.py
imports: from typing import List, Optional, Tuple, Union
  from torch import Tensor
  from torch.nn import BatchNorm1d, Dropout, InstanceNorm1d, LayerNorm, ReLU, Sequential
  from torch_geometric.nn.aggr import Aggregation, MultiAggregation
  from torch_geometric.nn.conv import MessagePassing
  from torch_geometric.nn.dense.linear import Linear
  from torch_geometric.nn.inits import reset
  from torch_geometric.nn.norm import MessageNorm
  from torch_geometric.typing import Adj, OptPairTensor, OptTensor, Size, SparseTensor
  from torch_geometric.utils import is_torch_sparse_tensor, to_edge_index
label_desc: Use image node_id 3 for calling the GENConv obj's underlying member method code with example usage: obj.forward(x, edge_index, edge_attr, size) and returns: self