class_docstr: Convolution together with iteratively reweighting least squre from
  `Graph Neural Networks Inspired by Classical Iterative Algorithms
  <https://arxiv.org/pdf/2103.06064.pdf>`__
  
  Parameters
  ----------
  input_d : int
      Number of input features.
  output_d : int
      Number of output features.
  hidden_d : int
      Size of hidden layers.
  prop_step : int
      Number of propagation steps
  num_mlp_before : int
      Number of mlp layers before propagation. Default: ``1``.
  num_mlp_after : int
      Number of mlp layers after propagation.  Default: ``1``.
  norm : str
      The type of norm layers inside mlp layers. Can be ``'batch'``, ``'layer'`` or ``'none'``.
      Default: ``'none'``
  precond : str
      If True, use pre conditioning and unormalized laplacian, else not use pre conditioning
      and use normalized laplacian. Default: ``True``
  alp : float
      The :math:`\alpha` in paper. If equal to :math:`0`, will be automatically decided based
      on other hyper prameters. Default: ``0``.
  lam : float
      The :math:`\lambda` in paper. Default: ``1``.
  attention : bool
      If ``True``, add an attention layer inside propagations. Default: ``False``.
  tau : float
      The :math:`\tau` in paper. Default: ``0.2``.
  T : float
      The :math:`T` in paper. If < 0, :math:`T` will be set to `\infty`. Default: ``-1``.
  p : float
      The :math:`p` in paper. Default: ``1``.
  use_eta : bool
      If ``True``, add a learnable weight on each dimension in attention. Default: ``False``.
  attn_bef : bool
      If ``True``, add another attention layer before propagation. Default: ``False``.
  dropout : float
      The dropout rate in mlp layers. Default: ``0.0``.
  attn_dropout : float
      The dropout rate of attention values. Default: ``0.0``.
  inp_dropout : float
      The dropout rate on input features. Default: ``0.0``.
  
  
  Note
  ----
   ``add_self_loop`` will be automatically called before propagation.
  
  Example
  -------
  >>> import dgl
  >>> from dgl.nn import TWIRLSConv
  >>> import torch as th
  
  >>> g = dgl.graph(([0,1,2,3,2,5], [1,2,3,4,0,3]))
  >>> feat = th.ones(6, 10)
  >>> conv = TWIRLSConv(10, 2, 128, prop_step = 64)
  >>> res = conv(g , feat)
  >>> res.size()
  torch.Size([6, 2])
class_docstr_tok: ["Convolution","together","with","iteratively","reweighting","least","squre","from","`","Graph","Neural","Networks","Inspired","by","Classical","Iterative","Algorithms","<","https",":","\/\/arxiv.org\/pdf\/2103.06064.pdf",">","`","__","Parameters","--","--","--","--","--","input_d",":","int","Number","of","input","features",".","output_d",":","int","Number","of","output","features",".","hidden_d",":","int","Size","of","hidden","layers",".","prop_step",":","int","Number","of","propagation","steps","num_mlp_before",":","int","Number","of","mlp","layers","before","propagation",".","Default",":","``","1","``",".","num_mlp_after",":","int","Number","of","mlp","layers","after","propagation",".","Default",":","``","1","``",".","norm",":","str","The","type","of","norm","layers","inside","mlp","layers",".","Can","be","``","'batch","'","``",",","``","'layer","'","``","or","``","'none","'","``",".","Default",":","``","'none","'","``","precond",":","str","If","True",",","use","pre","conditioning","and","unormalized","laplacian",",","else","not","use","pre","conditioning","and","use","normalized","laplacian",".","Default",":","``","True","``","alp",":","float","The",":","math",":","`","\\alpha","`","in","paper",".","If","equal","to",":","math",":","`","0","`",",","will","be","automatically","decided","based","on","other","hyper","prameters",".","Default",":","``","0","``",".","lam",":","float","The",":","math",":","`","\\lambda","`","in","paper",".","Default",":","``","1","``",".","attention",":","bool","If","``","True","``",",","add","an","attention","layer","inside","propagations",".","Default",":","``","False","``",".","tau",":","float","The",":","math",":","`","\\tau","`","in","paper",".","Default",":","``","0.2","``",".","T",":","float","The",":","math",":","`","T","`","in","paper",".","If","<","0",",",":","math",":","`","T","`","will","be","set","to","`","\\infty","`",".","Default",":","``","-1","``",".","p",":","float","The",":","math",":","`","p","`","in","paper",".","Default",":","``","1","``",".","use_eta",":","bool","If","``","True","``",",","add","a","learnable","weight","on","each","dimension","in","attention",".","Default",":","``","False","``",".","attn_bef",":","bool","If","``","True","``",",","add","another","attention","layer","before","propagation",".","Default",":","``","False","``",".","dropout",":","float","The","dropout","rate","in","mlp","layers",".","Default",":","``","0.0","``",".","attn_dropout",":","float","The","dropout","rate","of","attention","values",".","Default",":","``","0.0","``",".","inp_dropout",":","float","The","dropout","rate","on","input","features",".","Default",":","``","0.0","``",".","Note","--","--","``","add_self_loop","``","will","be","automatically","called","before","propagation",".","Example","--","--","--","-",">",">",">","import","dgl",">",">",">","from","dgl.nn","import","TWIRLSConv",">",">",">","import","torch","as","th",">",">",">","g","=","dgl.graph","(","(","[","0,1,2,3,2,5","]",",","[","1,2,3,4,0,3","]",")",")",">",">",">","feat","=","th.ones","(","6",",","10",")",">",">",">","conv","=","TWIRLSConv","(","10",",","2",",","128",",","prop_step","=","64",")",">",">",">","res","=","conv","(","g",",","feat",")",">",">",">","res.size","(",")","torch.Size","(","[","6",",","2","]",")"]
code: def __init__(
      self,
      input_d,
      output_d,
      hidden_d,
      prop_step,
      num_mlp_before=1,
      num_mlp_after=1,
      norm="none",
      precond=True,
      alp=0,
      lam=1,
      attention=False,
      tau=0.2,
      T=-1,
      p=1,
      use_eta=False,
      attn_bef=False,
      dropout=0.0,
      attn_dropout=0.0,
      inp_dropout=0.0,
  ):
      super().__init__()
      self.input_d = input_d
      self.output_d = output_d
      self.hidden_d = hidden_d
      self.prop_step = prop_step
      self.num_mlp_before = num_mlp_before
      self.num_mlp_after = num_mlp_after
      self.norm = norm
      self.precond = precond
      self.attention = attention
      self.alp = alp
      self.lam = lam
      self.tau = tau
      self.T = T
      self.p = p
      self.use_eta = use_eta
      self.init_att = attn_bef
      self.dropout = dropout
      self.attn_dropout = attn_dropout
      self.inp_dropout = inp_dropout
  
      # ----- initialization of some variables -----
      # where to put attention
      self.attn_aft = prop_step // 2 if attention else -1
  
      # whether we can cache unfolding result
      self.cacheable = (
          (not self.attention)
          and self.num_mlp_before == 0
          and self.inp_dropout <= 0
      )
      if self.cacheable:
          self.cached_unfolding = None
  
      # if only one layer, then no hidden size
      self.size_bef_unf = self.hidden_d
      self.size_aft_unf = self.hidden_d
      if self.num_mlp_before == 0:
          self.size_aft_unf = self.input_d  # as the input  of mlp_aft
      if self.num_mlp_after == 0:
          self.size_bef_unf = self.output_d  # as the output of mlp_bef
  
      # ----- computational modules -----
      self.mlp_bef = MLP(
          self.input_d,
          self.hidden_d,
          self.size_bef_unf,
          self.num_mlp_before,
          self.dropout,
          self.norm,
          init_activate=False,
      )
  
      self.unfolding = TWIRLSUnfoldingAndAttention(
          self.hidden_d,
          self.alp,
          self.lam,
          self.prop_step,
          self.attn_aft,
          self.tau,
          self.T,
          self.p,
          self.use_eta,
          self.init_att,
          self.attn_dropout,
          self.precond,
      )
  
      # if there are really transformations before unfolding, then do init_activate in mlp_aft
      self.mlp_aft = MLP(
          self.size_aft_unf,
          self.hidden_d,
          self.output_d,
          self.num_mlp_after,
          self.dropout,
          self.norm,
          init_activate=(self.num_mlp_before > 0)
          and (self.num_mlp_after > 0),
      )
  
imports: import torch
  import torch.nn
  import torch.nn.functional
  from ....None import function
label_desc: Use image node_id 1 to create a new TWIRLSConv object from inherited base classes: nn with example: obj = TWIRLSConv(input_d, output_d, hidden_d, prop_step, num_mlp_before, num_mlp_after, norm, precond, alp, lam, attention, tau, T, p, use_eta, attn_bef, dropout, attn_dropout, inp_dropout)