class_docstr: Description
  -----------
  The attention function. Correspond to :math:`s` in eq.27 the paper.
  
  Parameters
  ----------
  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..
  attn_dropout : float
      the dropout rate of attention value. Default: ``0.0``.
  
  Returns
  -------
  torch.Tensor
      The output feature
class_docstr_tok: ["Description","--","--","--","--","--","-","The","attention","function",".","Correspond","to",":","math",":","`","s","`","in","eq.27","the","paper",".","Parameters","--","--","--","--","--","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","..","attn_dropout",":","float","the","dropout","rate","of","attention","value",".","Default",":","``","0.0","``",".","Returns","--","--","--","-","torch.Tensor","The","output","feature"]
docstr: Description
  -----------
  Attention forward. Will update ``graph.edata['w']`` and ``graph.ndata['deg']``.
  
  Parameters
  ----------
  graph : DGLGraph
      The graph.
  Y : torch.Tensor
      The feature to compute attention.
  etas : float
      The weight of each dimension. If ``None``, then weight of each dimension is 1.
      Default: ``None``.
  
  Returns
  -------
  DGLGraph
      The graph.
docstr_tok: ["Description","--","--","--","--","--","-","Attention","forward",".","Will","update","``","graph.edata","[","'","w","'","]","``","and","``","graph.ndata","[","'deg","'","]","``",".","Parameters","--","--","--","--","--","graph",":","DGLGraph","The","graph",".","Y",":","torch.Tensor","The","feature","to","compute","attention",".","etas",":","float","The","weight","of","each","dimension",".","If","``","None","``",",","then","weight","of","each","dimension","is","1",".","Default",":","``","None","``",".","Returns","--","--","--","-","DGLGraph","The","graph","."]
code: def forward(self, graph, Y, etas=None):
      r"""
  
      Description
      -----------
      Attention forward. Will update ``graph.edata['w']`` and ``graph.ndata['deg']``.
  
      Parameters
      ----------
      graph : DGLGraph
          The graph.
      Y : torch.Tensor
          The feature to compute attention.
      etas : float
          The weight of each dimension. If ``None``, then weight of each dimension is 1.
          Default: ``None``.
  
      Returns
      -------
      DGLGraph
          The graph.
      """
  
      if etas is not None:
          Y = Y * etas.view(-1)
  
      # computing edge distance
      graph.srcdata["h"] = Y
      graph.srcdata["h_norm"] = (Y**2).sum(-1)
      graph.apply_edges(fn.u_dot_v("h", "h", "dot_"))
      graph.apply_edges(fn.u_add_v("h_norm", "h_norm", "norm_"))
      graph.edata["dot_"] = graph.edata["dot_"].view(-1)
      graph.edata["norm_"] = graph.edata["norm_"].view(-1)
      graph.edata["w"] = graph.edata["norm_"] - 2 * graph.edata["dot_"]
  
      # apply edge distance to get edge weight
      self.reweighting(graph)
  
      # update node degrees
      graph.update_all(fn.copy_e("w", "m"), fn.sum("m", "deg"))
      graph.ndata["deg"] = graph.ndata["deg"].view(-1)
  
      # attention dropout. the implementation can ensure the degrees do not change in expectation.
      # FIXME: consider if there is a better way
      if self.attn_dropout > 0:
          graph.edata["w"] = F.dropout(
              graph.edata["w"],
              self.attn_dropout,
              training=self.training,
          )
  
      return graph
  
imports: import torch
  import torch.nn
  import torch.nn.functional
  from ....None import function
label_desc: Use image node_id 3 for calling the Attention obj's underlying member method code with example usage: obj.forward(graph, Y, etas) and returns: graph