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","]","]",")"]
docstr: Description
  -----------
  Compute forward pass of propagation & attention.
  
  Parameters
  ----------
  g : DGLGraph
      The graph.
  X : torch.Tensor
      Init features.
  
  Returns
  -------
  torch.Tensor
      The graph.
docstr_tok: ["Description","--","--","--","--","--","-","Compute","forward","pass","of","propagation","&","attention",".","Parameters","--","--","--","--","--","g",":","DGLGraph","The","graph",".","X",":","torch.Tensor","Init","features",".","Returns","--","--","--","-","torch.Tensor","The","graph","."]
code: def forward(self, g, X):
      r"""
  
      Description
      -----------
      Compute forward pass of propagation & attention.
  
      Parameters
      ----------
      g : DGLGraph
          The graph.
      X : torch.Tensor
          Init features.
  
      Returns
      -------
      torch.Tensor
          The graph.
      """
      Y = X
  
      g.edata["w"] = tc.ones(g.num_edges(), 1, device=g.device)
      g.ndata["deg"] = g.in_degrees().to(X)
  
      if self.init_att:
          g = self.init_attn(g, Y, self.etas)
  
      for k, layer in enumerate(self.prop_layers):
          # do unfolding
          Y = layer(g, Y, X, self.alp, self.lam)
  
          # do attention at certain layer
          if k == self.attn_aft - 1:
              g = self.attn_layer(g, Y, self.etas)
  
      return Y
  
imports: import torch
  import torch.nn
  import torch.nn.functional
  from ....None import function
label_desc: Use image node_id 2 for calling the TWIRLSUnfoldingAndAttention obj's underlying member method code with example usage: obj.forward(g, X) and returns: Y