class_docstr: Description
  -----------
  Combine propagation and attention together.
  
  Parameters
  ----------
  d : int
      Size of graph feature.
  alp : float
      Step size. :math:`\alpha` in ther paper.
  lam : int
      Coefficient of graph smooth term. :math:`\lambda` in ther paper.
  prop_step : int
      Number of propagation steps
  attn_aft : int
      Where to put attention layer. i.e. number of propagation steps before attention.
      If set to ``-1``, then no attention.
  tau : float
      The lower thresholding parameter. Correspond to :math:`\tau` in the paper.
  T : float
      The upper thresholding parameter. Correspond to :math:`T` in the paper.
  p : float
      Correspond to :math:`\rho` in the paper..
  use_eta : bool
      If `True`, learn a weight vector for each dimension when doing attention.
  init_att : bool
      If ``True``, add an extra attention layer before propagation.
  attn_dropout : float
      the dropout rate of attention value. Default: ``0.0``.
  precond : bool
      If ``True``, use pre-conditioned & reparameterized version propagation (eq.28), else use
      normalized laplacian (eq.30).
  
  Example
  -------
  >>> import dgl
  >>> from dgl.nn import TWIRLSUnfoldingAndAttention
  >>> import torch as th
  
  >>> g = dgl.graph(([0, 1, 2, 3, 2, 5], [1, 2, 3, 4, 0, 3])).add_self_loop()
  >>> feat = th.ones(6,5)
  >>> prop = TWIRLSUnfoldingAndAttention(10, 1, 1, prop_step=3)
  >>> res = prop(g,feat)
  >>> res
  tensor([[2.5000, 2.5000, 2.5000, 2.5000, 2.5000],
          [2.5000, 2.5000, 2.5000, 2.5000, 2.5000],
          [2.5000, 2.5000, 2.5000, 2.5000, 2.5000],
          [3.7656, 3.7656, 3.7656, 3.7656, 3.7656],
          [2.5217, 2.5217, 2.5217, 2.5217, 2.5217],
          [4.0000, 4.0000, 4.0000, 4.0000, 4.0000]])
class_docstr_tok: ["Description","--","--","--","--","--","-","Combine","propagation","and","attention","together",".","Parameters","--","--","--","--","--","d",":","int","Size","of","graph","feature",".","alp",":","float","Step","size",".",":","math",":","`","\\alpha","`","in","ther","paper",".","lam",":","int","Coefficient","of","graph","smooth","term",".",":","math",":","`","\\lambda","`","in","ther","paper",".","prop_step",":","int","Number","of","propagation","steps","attn_aft",":","int","Where","to","put","attention","layer",".","i.e",".","number","of","propagation","steps","before","attention",".","If","set","to","``","-1","``",",","then","no","attention",".","tau",":","float","The","lower","thresholding","parameter",".","Correspond","to",":","math",":","`","\\tau","`","in","the","paper",".","T",":","float","The","upper","thresholding","parameter",".","Correspond","to",":","math",":","`","T","`","in","the","paper",".","p",":","float","Correspond","to",":","math",":","`","\\rho","`","in","the","paper","..","use_eta",":","bool","If","`","True","`",",","learn","a","weight","vector","for","each","dimension","when","doing","attention",".","init_att",":","bool","If","``","True","``",",","add","an","extra","attention","layer","before","propagation",".","attn_dropout",":","float","the","dropout","rate","of","attention","value",".","Default",":","``","0.0","``",".","precond",":","bool","If","``","True","``",",","use","pre-conditioned","&","reparameterized","version","propagation","(","eq.28",")",",","else","use","normalized","laplacian","(","eq.30",")",".","Example","--","--","--","-",">",">",">","import","dgl",">",">",">","from","dgl.nn","import","TWIRLSUnfoldingAndAttention",">",">",">","import","torch","as","th",">",">",">","g","=","dgl.graph","(","(","[","0",",","1",",","2",",","3",",","2",",","5","]",",","[","1",",","2",",","3",",","4",",","0",",","3","]",")",")",".add_self_loop","(",")",">",">",">","feat","=","th.ones","(","6,5",")",">",">",">","prop","=","TWIRLSUnfoldingAndAttention","(","10",",","1",",","1",",","prop_step=3",")",">",">",">","res","=","prop","(","g",",","feat",")",">",">",">","res","tensor","(","[","[","2.5000",",","2.5000",",","2.5000",",","2.5000",",","2.5000","]",",","[","2.5000",",","2.5000",",","2.5000",",","2.5000",",","2.5000","]",",","[","2.5000",",","2.5000",",","2.5000",",","2.5000",",","2.5000","]",",","[","3.7656",",","3.7656",",","3.7656",",","3.7656",",","3.7656","]",",","[","2.5217",",","2.5217",",","2.5217",",","2.5217",",","2.5217","]",",","[","4.0000",",","4.0000",",","4.0000",",","4.0000",",","4.0000","]","]",")"]
code: def __init__(
      self,
      d,
      alp,
      lam,
      prop_step,
      attn_aft=-1,
      tau=0.2,
      T=-1,
      p=1,
      use_eta=False,
      init_att=False,
      attn_dropout=0,
      precond=True,
  ):
      super().__init__()
  
      self.d = d
      self.alp = (
          alp if alp > 0 else 1 / (lam + 1)
      )  # automatic set alpha
      self.lam = lam
      self.tau = tau
      self.p = p
      self.prop_step = prop_step
      self.attn_aft = attn_aft
      self.use_eta = use_eta
      self.init_att = init_att
  
      prop_method = Propagate if precond else PropagateNoPrecond
      self.prop_layers = nn.ModuleList(
          [prop_method() for _ in range(prop_step)]
      )
  
      self.init_attn = (
          Attention(tau, T, p, attn_dropout) if self.init_att else None
      )
      self.attn_layer = (
          Attention(tau, T, p, attn_dropout)
          if self.attn_aft >= 0
          else None
      )
      self.etas = nn.Parameter(tc.ones(d)) if self.use_eta else None
  
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 TWIRLSUnfoldingAndAttention object from inherited base classes: nn with example: obj = TWIRLSUnfoldingAndAttention(d, alp, lam, prop_step, attn_aft, tau, T, p, use_eta, init_att, attn_dropout, precond)