class_docstr: Graph Convolutional Network via Initial residual
  and Identity mapping (GCNII) from `Simple and Deep Graph Convolutional
  Networks <https://arxiv.org/abs/2007.02133>`__
  
  It is mathematically is defined as follows:
  
  .. math::
  
      \mathbf{h}^{(l+1)} =\left( (1 - \alpha)(\mathbf{D}^{-1/2} \mathbf{\hat{A}}
      \mathbf{D}^{-1/2})\mathbf{h}^{(l)} + \alpha {\mathbf{h}^{(0)}} \right)
      \left( (1 - \beta_l) \mathbf{I} + \beta_l \mathbf{W} \right)
  
  where :math:`\mathbf{\hat{A}}` is the adjacency matrix with self-loops,
  :math:`\mathbf{D}_{ii} = \sum_{j=0} \mathbf{A}_{ij}` is its diagonal degree matrix,
  :math:`\mathbf{h}^{(0)}` is the initial node features,
  :math:`\mathbf{h}^{(l)}` is the feature of layer :math:`l`,
  :math:`\alpha` is the fraction of initial node features, and
  :math:`\beta_l` is the hyperparameter to tune the strength of identity mapping.
  It is defined by :math:`\beta_l = \log(\frac{\lambda}{l}+1)\approx\frac{\lambda}{l}`,
  where :math:`\lambda` is a hyperparameter. :math:`\beta` ensures that the decay of
  the weight matrix adaptively increases as we stack more layers.
  
  Parameters
  ----------
  in_feats : int
      Input feature size; i.e, the number of dimensions of :math:`h_j^{(l)}`.
  layer : int
      the index of current layer.
  alpha : float
      The fraction of the initial input features. Default: ``0.1``
  lambda_ : float
      The hyperparameter to ensure the decay of the weight matrix
      adaptively increases. Default: ``1``
  project_initial_features : bool
      Whether to share a weight matrix between initial features and
      smoothed features. Default: ``True``
  bias : bool, optional
      If True, adds a learnable bias to the output. Default: ``True``.
  activation : callable activation function/layer or None, optional
      If not None, applies an activation function to the updated node features.
      Default: ``None``.
  allow_zero_in_degree : bool, optional
      If there are 0-in-degree nodes in the graph, output for those nodes will be invalid
      since no message will be passed to those nodes. This is harmful for some applications
      causing silent performance regression. This module will raise a DGLError if it detects
      0-in-degree nodes in input graph. By setting ``True``, it will suppress the check
      and let the users handle it by themselves. Default: ``False``.
  
  Note
  ----
  Zero in-degree nodes will lead to invalid output value. This is because no message
  will be passed to those nodes, the aggregation function will be appied on empty input.
  A common practice to avoid this is to add a self-loop for each node in the graph if
  it is homogeneous, which can be achieved by:
  
  >>> g = ... # a DGLGraph
  >>> g = dgl.add_self_loop(g)
  
  Calling ``add_self_loop`` will not work for some graphs, for example, heterogeneous graph
  since the edge type can not be decided for self_loop edges. Set ``allow_zero_in_degree``
  to ``True`` for those cases to unblock the code and handle zero-in-degree nodes manually.
  A common practise to handle this is to filter out the nodes with zero-in-degree when use
  after conv.
  
  Examples
  --------
  >>> import dgl
  >>> import numpy as np
  >>> import torch as th
  >>> from dgl.nn import GCN2Conv
  
  >>> # Homogeneous graph
  >>> g = dgl.graph(([0,1,2,3,2,5], [1,2,3,4,0,3]))
  >>> feat = th.ones(6, 3)
  >>> g = dgl.add_self_loop(g)
  >>> conv1 = GCN2Conv(3, layer=1, alpha=0.5, \
  ...         project_initial_features=True, allow_zero_in_degree=True)
  >>> conv2 = GCN2Conv(3, layer=2, alpha=0.5, \
  ...         project_initial_features=True, allow_zero_in_degree=True)
  >>> res = feat
  >>> res = conv1(g, res, feat)
  >>> res = conv2(g, res, feat)
  >>> print(res)
  tensor([[1.3803, 3.3191, 2.9572],
          [1.3803, 3.3191, 2.9572],
          [1.3803, 3.3191, 2.9572],
          [1.4770, 3.8326, 3.2451],
          [1.3623, 3.2102, 2.8679],
          [1.3803, 3.3191, 2.9572]], grad_fn=<AddBackward0>)
class_docstr_tok: ["Graph","Convolutional","Network","via","Initial","residual","and","Identity","mapping","(","GCNII",")","from","`","Simple","and","Deep","Graph","Convolutional","Networks","<","https",":","\/\/arxiv.org\/abs\/2007.02133",">","`","__","It","is","mathematically","is","defined","as","follows",":","..","math",":",":","\\mathbf","{","h","}","^","{","(","l+1",")","}","=\\left","(","(","1","-","\\alpha",")","(","\\mathbf","{","D","}","^","{","-1\/2","}","\\mathbf","{","\\hat","{","A","}","}","\\mathbf","{","D","}","^","{","-1\/2","}",")","\\mathbf","{","h","}","^","{","(","l",")","}","+","\\alpha","{","\\mathbf","{","h","}","^","{","(","0",")","}","}","\\right",")","\\left","(","(","1","-","\\beta_l",")","\\mathbf","{","I","}","+","\\beta_l","\\mathbf","{","W","}","\\right",")","where",":","math",":","`","\\mathbf","{","\\hat","{","A","}","}","`","is","the","adjacency","matrix","with","self-loops",",",":","math",":","`","\\mathbf","{","D","}","_","{","ii","}","=","\\sum_","{","j=0","}","\\mathbf","{","A","}","_","{","ij","}","`","is","its","diagonal","degree","matrix",",",":","math",":","`","\\mathbf","{","h","}","^","{","(","0",")","}","`","is","the","initial","node","features",",",":","math",":","`","\\mathbf","{","h","}","^","{","(","l",")","}","`","is","the","feature","of","layer",":","math",":","`","l","`",",",":","math",":","`","\\alpha","`","is","the","fraction","of","initial","node","features",",","and",":","math",":","`","\\beta_l","`","is","the","hyperparameter","to","tune","the","strength","of","identity","mapping",".","It","is","defined","by",":","math",":","`","\\beta_l","=","\\log","(","\\frac","{","\\lambda","}","{","l","}","+1",")","\\approx\\frac","{","\\lambda","}","{","l","}","`",",","where",":","math",":","`","\\lambda","`","is","a","hyperparameter",".",":","math",":","`","\\beta","`","ensures","that","the","decay","of","the","weight","matrix","adaptively","increases","as","we","stack","more","layers",".","Parameters","--","--","--","--","--","in_feats",":","int","Input","feature","size",";","i.e",",","the","number","of","dimensions","of",":","math",":","`","h_j^","{","(","l",")","}","`",".","layer",":","int","the","index","of","current","layer",".","alpha",":","float","The","fraction","of","the","initial","input","features",".","Default",":","``","0.1","``","lambda_",":","float","The","hyperparameter","to","ensure","the","decay","of","the","weight","matrix","adaptively","increases",".","Default",":","``","1","``","project_initial_features",":","bool","Whether","to","share","a","weight","matrix","between","initial","features","and","smoothed","features",".","Default",":","``","True","``","bias",":","bool",",","optional","If","True",",","adds","a","learnable","bias","to","the","output",".","Default",":","``","True","``",".","activation",":","callable","activation","function\/layer","or","None",",","optional","If","not","None",",","applies","an","activation","function","to","the","updated","node","features",".","Default",":","``","None","``",".","allow_zero_in_degree",":","bool",",","optional","If","there","are","0-in-degree","nodes","in","the","graph",",","output","for","those","nodes","will","be","invalid","since","no","message","will","be","passed","to","those","nodes",".","This","is","harmful","for","some","applications","causing","silent","performance","regression",".","This","module","will","raise","a","DGLError","if","it","detects","0-in-degree","nodes","in","input","graph",".","By","setting","``","True","``",",","it","will","suppress","the","check","and","let","the","users","handle","it","by","themselves",".","Default",":","``","False","``",".","Note","--","--","Zero","in-degree","nodes","will","lead","to","invalid","output","value",".","This","is","because","no","message","will","be","passed","to","those","nodes",",","the","aggregation","function","will","be","appied","on","empty","input",".","A","common","practice","to","avoid","this","is","to","add","a","self-loop","for","each","node","in","the","graph","if","it","is","homogeneous",",","which","can","be","achieved","by",":",">",">",">","g","=","...","#","a","DGLGraph",">",">",">","g","=","dgl.add_self_loop","(","g",")","Calling","``","add_self_loop","``","will","not","work","for","some","graphs",",","for","example",",","heterogeneous","graph","since","the","edge","type","can","not","be","decided","for","self_loop","edges",".","Set","``","allow_zero_in_degree","``","to","``","True","``","for","those","cases","to","unblock","the","code","and","handle","zero-in-degree","nodes","manually",".","A","common","practise","to","handle","this","is","to","filter","out","the","nodes","with","zero-in-degree","when","use","after","conv",".","Examples","--","--","--","--",">",">",">","import","dgl",">",">",">","import","numpy","as","np",">",">",">","import","torch","as","th",">",">",">","from","dgl.nn","import","GCN2Conv",">",">",">","#","Homogeneous","graph",">",">",">","g","=","dgl.graph","(","(","[","0,1,2,3,2,5","]",",","[","1,2,3,4,0,3","]",")",")",">",">",">","feat","=","th.ones","(","6",",","3",")",">",">",">","g","=","dgl.add_self_loop","(","g",")",">",">",">","conv1","=","GCN2Conv","(","3",",","layer=1",",","alpha=0.5",",","\\","...","project_initial_features=True",",","allow_zero_in_degree=True",")",">",">",">","conv2","=","GCN2Conv","(","3",",","layer=2",",","alpha=0.5",",","\\","...","project_initial_features=True",",","allow_zero_in_degree=True",")",">",">",">","res","=","feat",">",">",">","res","=","conv1","(","g",",","res",",","feat",")",">",">",">","res","=","conv2","(","g",",","res",",","feat",")",">",">",">","print","(","res",")","tensor","(","[","[","1.3803",",","3.3191",",","2.9572","]",",","[","1.3803",",","3.3191",",","2.9572","]",",","[","1.3803",",","3.3191",",","2.9572","]",",","[","1.4770",",","3.8326",",","3.2451","]",",","[","1.3623",",","3.2102",",","2.8679","]",",","[","1.3803",",","3.3191",",","2.9572","]","]",",","grad_fn=","<","AddBackward0",">",")"]
docstr: Set the extra representation of the module,
  which will come into effect when printing the model.
docstr_tok: ["Set","the","extra","representation","of","the","module",",","which","will","come","into","effect","when","printing","the","model","."]
code: def extra_repr(self):
      """Set the extra representation of the module,
      which will come into effect when printing the model.
      """
      summary = "in={_in_feats}"
      summary += ", alpha={alpha}, beta={beta}"
      if "self._bias" in self.__dict__:
          summary += ", bias={bias}"
      if "self._activation" in self.__dict__:
          summary += ", activation={_activation}"
  
      return summary.format(**self.__dict__)
  
file_path: dgl/python/dgl/nn/pytorch/conv/gcn2conv.py
imports: import math
  import torch
  from torch import nn
  from ....None import function
  from ....base import DGLError
  from .graphconv import EdgeWeightNorm
label_desc: Use image node_id 5 for calling the GCN2Conv obj's underlying member method code with example usage: obj.extra_repr() and returns: summary