class_docstr: QM9 dataset for graph property prediction (regression)
  
  This dataset consists of 130,831 molecules with 12 regression targets.
  Nodes correspond to atoms and edges correspond to close atom pairs.
  
  This dataset differs from :class:`~dgl.data.QM9EdgeDataset` in the following aspects:
      1. Edges in this dataset are purely distance-based.
      2. It only provides atoms' coordinates and atomic numbers as node features
      3. It only provides 12 regression targets.
  
  Reference:
  
  - `"Quantum-Machine.org" <http://quantum-machine.org/datasets/>`_,
  - `"Directional Message Passing for Molecular Graphs" <https://arxiv.org/abs/2003.03123>`_
  
  Statistics:
  
  - Number of graphs: 130,831
  - Number of regression targets: 12
  
  +--------+----------------------------------+-----------------------------------------------------------------------------------+---------------------------------------------+
  | Keys   | Property                         | Description                                                                       | Unit                                        |
  +========+==================================+===================================================================================+=============================================+
  | mu     | :math:`\mu`                      | Dipole moment                                                                     | :math:`\textrm{D}`                          |
  +--------+----------------------------------+-----------------------------------------------------------------------------------+---------------------------------------------+
  | alpha  | :math:`\alpha`                   | Isotropic polarizability                                                          | :math:`{a_0}^3`                             |
  +--------+----------------------------------+-----------------------------------------------------------------------------------+---------------------------------------------+
  | homo   | :math:`\epsilon_{\textrm{HOMO}}` | Highest occupied molecular orbital energy                                         | :math:`\textrm{eV}`                         |
  +--------+----------------------------------+-----------------------------------------------------------------------------------+---------------------------------------------+
  | lumo   | :math:`\epsilon_{\textrm{LUMO}}` | Lowest unoccupied molecular orbital energy                                        | :math:`\textrm{eV}`                         |
  +--------+----------------------------------+-----------------------------------------------------------------------------------+---------------------------------------------+
  | gap    | :math:`\Delta \epsilon`          | Gap between :math:`\epsilon_{\textrm{HOMO}}` and :math:`\epsilon_{\textrm{LUMO}}` | :math:`\textrm{eV}`                         |
  +--------+----------------------------------+-----------------------------------------------------------------------------------+---------------------------------------------+
  | r2     | :math:`\langle R^2 \rangle`      | Electronic spatial extent                                                         | :math:`{a_0}^2`                             |
  +--------+----------------------------------+-----------------------------------------------------------------------------------+---------------------------------------------+
  | zpve   | :math:`\textrm{ZPVE}`            | Zero point vibrational energy                                                     | :math:`\textrm{eV}`                         |
  +--------+----------------------------------+-----------------------------------------------------------------------------------+---------------------------------------------+
  | U0     | :math:`U_0`                      | Internal energy at 0K                                                             | :math:`\textrm{eV}`                         |
  +--------+----------------------------------+-----------------------------------------------------------------------------------+---------------------------------------------+
  | U      | :math:`U`                        | Internal energy at 298.15K                                                        | :math:`\textrm{eV}`                         |
  +--------+----------------------------------+-----------------------------------------------------------------------------------+---------------------------------------------+
  | H      | :math:`H`                        | Enthalpy at 298.15K                                                               | :math:`\textrm{eV}`                         |
  +--------+----------------------------------+-----------------------------------------------------------------------------------+---------------------------------------------+
  | G      | :math:`G`                        | Free energy at 298.15K                                                            | :math:`\textrm{eV}`                         |
  +--------+----------------------------------+-----------------------------------------------------------------------------------+---------------------------------------------+
  | Cv     | :math:`c_{\textrm{v}}`           | Heat capavity at 298.15K                                                          | :math:`\frac{\textrm{cal}}{\textrm{mol K}}` |
  +--------+----------------------------------+-----------------------------------------------------------------------------------+---------------------------------------------+
  
  Parameters
  ----------
  label_keys : list
      Names of the regression property, which should be a subset of the keys in the table above.
  cutoff : float
      Cutoff distance for interatomic interactions, i.e. two atoms are connected in the corresponding graph if the distance between them is no larger than this.
      Default: 5.0 Angstrom
  raw_dir : str
      Raw file directory to download/contains the input data directory.
      Default: ~/.dgl/
  force_reload : bool
      Whether to reload the dataset. Default: False
  verbose : bool
      Whether to print out progress information. Default: True.
  transform : callable, optional
      A transform that takes in a :class:`~dgl.DGLGraph` object and returns
      a transformed version. The :class:`~dgl.DGLGraph` object will be
      transformed before every access.
  
  Attributes
  ----------
  num_tasks : int
      Number of prediction tasks
  num_labels : int
      (DEPRECATED, use num_tasks instead) Number of prediction tasks
  
  Raises
  ------
  UserWarning
      If the raw data is changed in the remote server by the author.
  
  Examples
  --------
  >>> data = QM9Dataset(label_keys=['mu', 'gap'], cutoff=5.0)
  >>> data.num_tasks
  2
  >>>
  >>> # iterate over the dataset
  >>> for g, label in data:
  ...     R = g.ndata['R'] # get coordinates of each atom
  ...     Z = g.ndata['Z'] # get atomic numbers of each atom
  ...     # your code here...
  >>>
class_docstr_tok: ["QM9","dataset","for","graph","property","prediction","(","regression",")","This","dataset","consists","of","130,831","molecules","with","12","regression","targets",".","Nodes","correspond","to","atoms","and","edges","correspond","to","close","atom","pairs",".","This","dataset","differs","from",":","class",":","`","~dgl.data.QM9EdgeDataset","`","in","the","following","aspects",":","1",".","Edges","in","this","dataset","are","purely","distance-based",".","2",".","It","only","provides","atoms","'","coordinates","and","atomic","numbers","as","node","features","3",".","It","only","provides","12","regression","targets",".","Reference",":","-","`","``","Quantum-Machine.org","''","<","http",":","\/\/quantum-machine.org\/datasets\/",">","`","_",",","-","`","``","Directional","Message","Passing","for","Molecular","Graphs","''","<","https",":","\/\/arxiv.org\/abs\/2003.03123",">","`","_","Statistics",":","-","Number","of","graphs",":","130,831","-","Number","of","regression","targets",":","12","+","--","--","--","--","+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","-+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","-+","|","Keys","|","Property","|","Description","|","Unit","|","+========+==================================+===================================================================================+=============================================+","|","mu","|",":","math",":","`","\\mu","`","|","Dipole","moment","|",":","math",":","`","\\textrm","{","D","}","`","|","+","--","--","--","--","+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","-+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","-+","|","alpha","|",":","math",":","`","\\alpha","`","|","Isotropic","polarizability","|",":","math",":","`","{","a_0","}","^3","`","|","+","--","--","--","--","+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","-+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","-+","|","homo","|",":","math",":","`","\\epsilon_","{","\\textrm","{","HOMO","}","}","`","|","Highest","occupied","molecular","orbital","energy","|",":","math",":","`","\\textrm","{","eV","}","`","|","+","--","--","--","--","+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","-+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","-+","|","lumo","|",":","math",":","`","\\epsilon_","{","\\textrm","{","LUMO","}","}","`","|","Lowest","unoccupied","molecular","orbital","energy","|",":","math",":","`","\\textrm","{","eV","}","`","|","+","--","--","--","--","+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","-+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","-+","|","gap","|",":","math",":","`","\\Delta","\\epsilon","`","|","Gap","between",":","math",":","`","\\epsilon_","{","\\textrm","{","HOMO","}","}","`","and",":","math",":","`","\\epsilon_","{","\\textrm","{","LUMO","}","}","`","|",":","math",":","`","\\textrm","{","eV","}","`","|","+","--","--","--","--","+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","-+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","-+","|","r2","|",":","math",":","`","\\langle","R^2","\\rangle","`","|","Electronic","spatial","extent","|",":","math",":","`","{","a_0","}","^2","`","|","+","--","--","--","--","+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","-+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","-+","|","zpve","|",":","math",":","`","\\textrm","{","ZPVE","}","`","|","Zero","point","vibrational","energy","|",":","math",":","`","\\textrm","{","eV","}","`","|","+","--","--","--","--","+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","-+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","-+","|","U0","|",":","math",":","`","U_0","`","|","Internal","energy","at","0K","|",":","math",":","`","\\textrm","{","eV","}","`","|","+","--","--","--","--","+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","-+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","-+","|","U","|",":","math",":","`","U","`","|","Internal","energy","at","298.15K","|",":","math",":","`","\\textrm","{","eV","}","`","|","+","--","--","--","--","+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","-+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","-+","|","H","|",":","math",":","`","H","`","|","Enthalpy","at","298.15K","|",":","math",":","`","\\textrm","{","eV","}","`","|","+","--","--","--","--","+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","-+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","-+","|","G","|",":","math",":","`","G","`","|","Free","energy","at","298.15K","|",":","math",":","`","\\textrm","{","eV","}","`","|","+","--","--","--","--","+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","-+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","-+","|","Cv","|",":","math",":","`","c_","{","\\textrm","{","v","}","}","`","|","Heat","capavity","at","298.15K","|",":","math",":","`","\\frac","{","\\textrm","{","cal","}","}","{","\\textrm","{","mol","K","}","}","`","|","+","--","--","--","--","+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","-+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","-+","Parameters","--","--","--","--","--","label_keys",":","list","Names","of","the","regression","property",",","which","should","be","a","subset","of","the","keys","in","the","table","above",".","cutoff",":","float","Cutoff","distance","for","interatomic","interactions",",","i.e",".","two","atoms","are","connected","in","the","corresponding","graph","if","the","distance","between","them","is","no","larger","than","this",".","Default",":","5.0","Angstrom","raw_dir",":","str","Raw","file","directory","to","download\/contains","the","input","data","directory",".","Default",":","~\/.dgl\/","force_reload",":","bool","Whether","to","reload","the","dataset",".","Default",":","False","verbose",":","bool","Whether","to","print","out","progress","information",".","Default",":","True",".","transform",":","callable",",","optional","A","transform","that","takes","in","a",":","class",":","`","~dgl.DGLGraph","`","object","and","returns","a","transformed","version",".","The",":","class",":","`","~dgl.DGLGraph","`","object","will","be","transformed","before","every","access",".","Attributes","--","--","--","--","--","num_tasks",":","int","Number","of","prediction","tasks","num_labels",":","int","(","DEPRECATED",",","use","num_tasks","instead",")","Number","of","prediction","tasks","Raises","--","--","--","UserWarning","If","the","raw","data","is","changed","in","the","remote","server","by","the","author",".","Examples","--","--","--","--",">",">",">","data","=","QM9Dataset","(","label_keys=","[","'mu","'",",","'gap","'","]",",","cutoff=5.0",")",">",">",">","data.num_tasks","2",">",">",">",">",">",">","#","iterate","over","the","dataset",">",">",">","for","g",",","label","in","data",":","...","R","=","g.ndata","[","'","R","'","]","#","get","coordinates","of","each","atom","...","Z","=","g.ndata","[","'","Z","'","]","#","get","atomic","numbers","of","each","atom","...","#","your","code","here","...",">",">",">"]
docstr: Get graph and label by index
  
  Parameters
  ----------
  idx : int
      Item index
  
  Returns
  -------
  dgl.DGLGraph
      The graph contains:
  
      - ``ndata['R']``: the coordinates of each atom
      - ``ndata['Z']``: the atomic number
  
  Tensor
      Property values of molecular graphs
docstr_tok: ["Get","graph","and","label","by","index","Parameters","--","--","--","--","--","idx",":","int","Item","index","Returns","--","--","--","-","dgl.DGLGraph","The","graph","contains",":","-","``","ndata","[","'","R","'","]","``",":","the","coordinates","of","each","atom","-","``","ndata","[","'","Z","'","]","``",":","the","atomic","number","Tensor","Property","values","of","molecular","graphs"]
code: def __getitem__(self, idx):
      r"""Get graph and label by index
  
      Parameters
      ----------
      idx : int
          Item index
  
      Returns
      -------
      dgl.DGLGraph
          The graph contains:
  
          - ``ndata['R']``: the coordinates of each atom
          - ``ndata['Z']``: the atomic number
  
      Tensor
          Property values of molecular graphs
      """
      label = F.tensor(
          self.label[idx], dtype=F.data_type_dict["float32"]
      )
      n_atoms = self.N[idx]
      R = self.R[self.N_cumsum[idx] : self.N_cumsum[idx + 1]]
      dist = np.linalg.norm(R[:, None, :] - R[None, :, :], axis=-1)
      adj = sp.csr_matrix(dist <= self.cutoff) - sp.eye(
          n_atoms, dtype=np.bool_
      )
      adj = adj.tocoo()
      u, v = F.tensor(adj.row), F.tensor(adj.col)
      g = dgl_graph((u, v))
      g = to_bidirected(g)
      g.ndata["R"] = F.tensor(R, dtype=F.data_type_dict["float32"])
      g.ndata["Z"] = F.tensor(
          self.Z[self.N_cumsum[idx] : self.N_cumsum[idx + 1]],
          dtype=F.data_type_dict["int64"],
      )
  
      if self._transform is not None:
          g = self._transform(g)
  
      return g, label
  
file_path: dgl/python/dgl/data/qm9.py
imports: import os
  import numpy
  import scipy.sparse
  from ..None import backend
  from ..convert import graph
  from ..transforms import to_bidirected
  from .dgl_dataset import DGLDataset
  from .utils import _get_dgl_url, download
label_desc: Use image node_id 7 for calling the QM9Dataset obj's underlying member method code with example usage: obj.__getitem__(idx) and returns: g,  label