class_docstr: Label Propagation from `Learning from Labeled and Unlabeled Data with Label
  Propagation <http://mlg.eng.cam.ac.uk/zoubin/papers/CMU-CALD-02-107.pdf>`__
  
  .. math::
  
      \mathbf{Y}^{(t+1)} = \alpha \tilde{A} \mathbf{Y}^{(t)} + (1 - \alpha) \mathbf{Y}^{(0)}
  
  where unlabeled data is initially set to zero and inferred from labeled data via
  propagation. :math:`\alpha` is a weight parameter for balancing between updated labels
  and initial labels. :math:`\tilde{A}` denotes the normalized adjacency matrix.
  
  Parameters
  ----------
  k: int
      The number of propagation steps.
  alpha : float
      The :math:`\alpha` coefficient in range [0, 1].
  norm_type : str, optional
      The type of normalization applied to the adjacency matrix, must be one of the
      following choices:
  
      * ``row``: row-normalized adjacency as :math:`D^{-1}A`
  
      * ``sym``: symmetrically normalized adjacency as :math:`D^{-1/2}AD^{-1/2}`
  
      Default: 'sym'.
  clamp : bool, optional
      A bool flag to indicate whether to clamp the labels to [0, 1] after propagation.
      Default: True.
  normalize: bool, optional
      A bool flag to indicate whether to apply row-normalization after propagation.
      Default: False.
  reset : bool, optional
      A bool flag to indicate whether to reset the known labels after each
      propagation step. Default: False.
  
  Examples
  --------
  >>> import torch
  >>> import dgl
  >>> from dgl.nn import LabelPropagation
  
  >>> label_propagation = LabelPropagation(k=5, alpha=0.5, clamp=False, normalize=True)
  >>> g = dgl.rand_graph(5, 10)
  >>> labels = torch.tensor([0, 2, 1, 3, 0]).long()
  >>> mask = torch.tensor([0, 1, 1, 1, 0]).bool()
  >>> new_labels = label_propagation(g, labels, mask)
class_docstr_tok: ["Label","Propagation","from","`","Learning","from","Labeled","and","Unlabeled","Data","with","Label","Propagation","<","http",":","\/\/mlg.eng.cam.ac.uk\/zoubin\/papers\/CMU-CALD-02-107.pdf",">","`","__","..","math",":",":","\\mathbf","{","Y","}","^","{","(","t+1",")","}","=","\\alpha","\\tilde","{","A","}","\\mathbf","{","Y","}","^","{","(","t",")","}","+","(","1","-","\\alpha",")","\\mathbf","{","Y","}","^","{","(","0",")","}","where","unlabeled","data","is","initially","set","to","zero","and","inferred","from","labeled","data","via","propagation",".",":","math",":","`","\\alpha","`","is","a","weight","parameter","for","balancing","between","updated","labels","and","initial","labels",".",":","math",":","`","\\tilde","{","A","}","`","denotes","the","normalized","adjacency","matrix",".","Parameters","--","--","--","--","--","k",":","int","The","number","of","propagation","steps",".","alpha",":","float","The",":","math",":","`","\\alpha","`","coefficient","in","range","[","0",",","1","]",".","norm_type",":","str",",","optional","The","type","of","normalization","applied","to","the","adjacency","matrix",",","must","be","one","of","the","following","choices",":","*","``","row","``",":","row-normalized","adjacency","as",":","math",":","`","D^","{","-1","}","A","`","*","``","sym","``",":","symmetrically","normalized","adjacency","as",":","math",":","`","D^","{","-1\/2","}","AD^","{","-1\/2","}","`","Default",":","'sym","'",".","clamp",":","bool",",","optional","A","bool","flag","to","indicate","whether","to","clamp","the","labels","to","[","0",",","1","]","after","propagation",".","Default",":","True",".","normalize",":","bool",",","optional","A","bool","flag","to","indicate","whether","to","apply","row-normalization","after","propagation",".","Default",":","False",".","reset",":","bool",",","optional","A","bool","flag","to","indicate","whether","to","reset","the","known","labels","after","each","propagation","step",".","Default",":","False",".","Examples","--","--","--","--",">",">",">","import","torch",">",">",">","import","dgl",">",">",">","from","dgl.nn","import","LabelPropagation",">",">",">","label_propagation","=","LabelPropagation","(","k=5",",","alpha=0.5",",","clamp=False",",","normalize=True",")",">",">",">","g","=","dgl.rand_graph","(","5",",","10",")",">",">",">","labels","=","torch.tensor","(","[","0",",","2",",","1",",","3",",","0","]",")",".long","(",")",">",">",">","mask","=","torch.tensor","(","[","0",",","1",",","1",",","1",",","0","]",")",".bool","(",")",">",">",">","new_labels","=","label_propagation","(","g",",","labels",",","mask",")"]
code: def __init__(
      self,
      k,
      alpha,
      norm_type="sym",
      clamp=True,
      normalize=False,
      reset=False,
  ):
      super(LabelPropagation, self).__init__()
      self.k = k
      self.alpha = alpha
      self.norm_type = norm_type
      self.clamp = clamp
      self.normalize = normalize
      self.reset = reset
  
imports: import torch
  import torch.nn.functional
  from torch import nn
  from ...None import DGLGraph, function
  from ...base import dgl_warning
label_desc: Use image node_id 1 to create a new LabelPropagation object from inherited base classes: nn with example: obj = LabelPropagation(k, alpha, norm_type, clamp, normalize, reset)