class_docstr: Processes the graph via Graph Diffusion Convolution (GDC) from the
  `"Diffusion Improves Graph Learning" <https://www.kdd.in.tum.de/gdc>`_
  paper (functional name: :obj:`gdc`).
  
  .. note::
  
      The paper offers additional advice on how to choose the
      hyperparameters.
      For an example of using GCN with GDC, see `examples/gcn.py
      <https://github.com/pyg-team/pytorch_geometric/blob/master/examples/
      gcn.py>`_.
  
  Args:
      self_loop_weight (float, optional): Weight of the added self-loop.
          Set to :obj:`None` to add no self-loops. (default: :obj:`1`)
      normalization_in (str, optional): Normalization of the transition
          matrix on the original (input) graph. Possible values:
          :obj:`"sym"`, :obj:`"col"`, and :obj:`"row"`.
          See :func:`GDC.transition_matrix` for details.
          (default: :obj:`"sym"`)
      normalization_out (str, optional): Normalization of the transition
          matrix on the transformed GDC (output) graph. Possible values:
          :obj:`"sym"`, :obj:`"col"`, :obj:`"row"`, and :obj:`None`.
          See :func:`GDC.transition_matrix` for details.
          (default: :obj:`"col"`)
      diffusion_kwargs (dict, optional): Dictionary containing the parameters
          for diffusion.
          `method` specifies the diffusion method (:obj:`"ppr"`,
          :obj:`"heat"` or :obj:`"coeff"`).
          Each diffusion method requires different additional parameters.
          See :func:`GDC.diffusion_matrix_exact` or
          :func:`GDC.diffusion_matrix_approx` for details.
          (default: :obj:`dict(method='ppr', alpha=0.15)`)
      sparsification_kwargs (dict, optional): Dictionary containing the
          parameters for sparsification.
          `method` specifies the sparsification method (:obj:`"threshold"` or
          :obj:`"topk"`).
          Each sparsification method requires different additional
          parameters.
          See :func:`GDC.sparsify_dense` for details.
          (default: :obj:`dict(method='threshold', avg_degree=64)`)
      exact (bool, optional): Whether to exactly calculate the diffusion
          matrix.
          Note that the exact variants are not scalable.
          They densify the adjacency matrix and calculate either its inverse
          or its matrix exponential.
          However, the approximate variants do not support edge weights and
          currently only personalized PageRank and sparsification by
          threshold are implemented as fast, approximate versions.
          (default: :obj:`True`)
  
  :rtype: :class:`torch_geometric.data.Data`
class_docstr_tok: ["Processes","the","graph","via","Graph","Diffusion","Convolution","(","GDC",")","from","the","`","``","Diffusion","Improves","Graph","Learning","''","<","https",":","\/\/www.kdd.in.tum.de\/gdc",">","`","_","paper","(","functional","name",":",":","obj",":","`","gdc","`",")",".","..","note",":",":","The","paper","offers","additional","advice","on","how","to","choose","the","hyperparameters",".","For","an","example","of","using","GCN","with","GDC",",","see","`","examples\/gcn.py","<","https",":","\/\/github.com\/pyg-team\/pytorch_geometric\/blob\/master\/examples\/","gcn.py",">","`","_",".","Args",":","self_loop_weight","(","float",",","optional",")",":","Weight","of","the","added","self-loop",".","Set","to",":","obj",":","`","None","`","to","add","no","self-loops",".","(","default",":",":","obj",":","`","1","`",")","normalization_in","(","str",",","optional",")",":","Normalization","of","the","transition","matrix","on","the","original","(","input",")","graph",".","Possible","values",":",":","obj",":","`","``","sym","''","`",",",":","obj",":","`","``","col","''","`",",","and",":","obj",":","`","``","row","''","`",".","See",":","func",":","`","GDC.transition_matrix","`","for","details",".","(","default",":",":","obj",":","`","``","sym","''","`",")","normalization_out","(","str",",","optional",")",":","Normalization","of","the","transition","matrix","on","the","transformed","GDC","(","output",")","graph",".","Possible","values",":",":","obj",":","`","``","sym","''","`",",",":","obj",":","`","``","col","''","`",",",":","obj",":","`","``","row","''","`",",","and",":","obj",":","`","None","`",".","See",":","func",":","`","GDC.transition_matrix","`","for","details",".","(","default",":",":","obj",":","`","``","col","''","`",")","diffusion_kwargs","(","dict",",","optional",")",":","Dictionary","containing","the","parameters","for","diffusion",".","`","method","`","specifies","the","diffusion","method","(",":","obj",":","`","``","ppr","''","`",",",":","obj",":","`","``","heat","''","`","or",":","obj",":","`","``","coeff","''","`",")",".","Each","diffusion","method","requires","different","additional","parameters",".","See",":","func",":","`","GDC.diffusion_matrix_exact","`","or",":","func",":","`","GDC.diffusion_matrix_approx","`","for","details",".","(","default",":",":","obj",":","`","dict","(","method='ppr","'",",","alpha=0.15",")","`",")","sparsification_kwargs","(","dict",",","optional",")",":","Dictionary","containing","the","parameters","for","sparsification",".","`","method","`","specifies","the","sparsification","method","(",":","obj",":","`","``","threshold","''","`","or",":","obj",":","`","``","topk","''","`",")",".","Each","sparsification","method","requires","different","additional","parameters",".","See",":","func",":","`","GDC.sparsify_dense","`","for","details",".","(","default",":",":","obj",":","`","dict","(","method='threshold","'",",","avg_degree=64",")","`",")","exact","(","bool",",","optional",")",":","Whether","to","exactly","calculate","the","diffusion","matrix",".","Note","that","the","exact","variants","are","not","scalable",".","They","densify","the","adjacency","matrix","and","calculate","either","its","inverse","or","its","matrix","exponential",".","However",",","the","approximate","variants","do","not","support","edge","weights","and","currently","only","personalized","PageRank","and","sparsification","by","threshold","are","implemented","as","fast",",","approximate","versions",".","(","default",":",":","obj",":","`","True","`",")",":","rtype",":",":","class",":","`","torch_geometric.data.Data","`"]
code: def forward(self, data: Data) -> Data:
      assert data.edge_index is not None
      edge_index = data.edge_index
      N = data.num_nodes
      assert N is not None
  
      if data.edge_attr is None:
          edge_weight = torch.ones(
              edge_index.size(1), device=edge_index.device
          )
      else:
          edge_weight = data.edge_attr
          assert self.exact
          assert edge_weight.dim() == 1
  
      if self.self_loop_weight:
          edge_index, edge_weight = add_self_loops(
              edge_index,
              edge_weight,
              fill_value=self.self_loop_weight,
              num_nodes=N,
          )
  
      edge_index, edge_weight = coalesce(edge_index, edge_weight, N)
  
      if self.exact:
          edge_index, edge_weight = self.transition_matrix(
              edge_index, edge_weight, N, self.normalization_in
          )
          diff_mat = self.diffusion_matrix_exact(
              edge_index, edge_weight, N, **self.diffusion_kwargs
          )
          edge_index, edge_weight = self.sparsify_dense(
              diff_mat, **self.sparsification_kwargs
          )
      else:
          edge_index, edge_weight = self.diffusion_matrix_approx(
              edge_index,
              edge_weight,
              N,
              self.normalization_in,
              **self.diffusion_kwargs,
          )
          edge_index, edge_weight = self.sparsify_sparse(
              edge_index, edge_weight, N, **self.sparsification_kwargs
          )
  
      edge_index, edge_weight = coalesce(edge_index, edge_weight, N)
      edge_index, edge_weight = self.transition_matrix(
          edge_index, edge_weight, N, self.normalization_out
      )
  
      data.edge_index = edge_index
      data.edge_attr = edge_weight
  
      return data
  
imports: from typing import Any, Dict, Tuple
  import numpy
  import torch
  from scipy.linalg import expm
  from torch import Tensor
  from torch_geometric.data import Data
  from torch_geometric.data.datapipes import functional_transform
  from torch_geometric.transforms import BaseTransform
  from torch_geometric.utils import add_self_loops, coalesce, get_ppr, is_undirected, scatter, sort_edge_index, to_dense_adj
label_desc: Use image node_id 2 for calling the GDC obj's underlying member method code with example usage: obj.forward(data) and returns: data