class_docstr: Data Reader for Open Graph Benchmark datasets.
docstr: Initializes the data reader by loading in data.
code: def __init__(
      self,
      data_path,
      master_csv_path,
      split_path,
      batch_size=1,
      dynamically_batch=False,
  ):
      """Initializes the data reader by loading in data."""
      with pathlib.Path(master_csv_path).open("rt") as fp:
          self._dataset_info = pd.read_csv(fp, index_col=0)[
              "ogbg-molhiv"
          ]
      self._data_path = pathlib.Path(data_path)
      # Load edge information, and transpose into (senders, receivers).
      with pathlib.Path(data_path, "edge.csv.gz").open("rb") as fp:
          sender_receivers = pd.read_csv(
              fp, compression="gzip", header=None
          ).values.T.astype(np.int64)
          self._senders = sender_receivers[0]
          self._receivers = sender_receivers[1]
      # Load n_node and n_edge
      with pathlib.Path(data_path, "num-node-list.csv.gz").open(
          "rb"
      ) as fp:
          self._n_node = pd.read_csv(
              fp, compression="gzip", header=None
          )
          self._n_node = self._n_node.astype(np.int64)[0].tolist()
      with pathlib.Path(data_path, "num-edge-list.csv.gz").open(
          "rb"
      ) as fp:
          self._n_edge = pd.read_csv(
              fp, compression="gzip", header=None
          )
          self._n_edge = self._n_edge.astype(np.int64)[0].tolist()
      # Load node features
      with pathlib.Path(data_path, "node-feat.csv.gz").open("rb") as fp:
          self._nodes = (
              pd.read_csv(fp, compression="gzip", header=None)
              .astype(np.float32)
              .values
          )
      with pathlib.Path(data_path, "edge-feat.csv.gz").open("rb") as fp:
          self._edges = (
              pd.read_csv(fp, compression="gzip", header=None)
              .astype(np.float32)
              .values
          )
      with pathlib.Path(data_path, "graph-label.csv.gz").open(
          "rb"
      ) as fp:
          self._labels = pd.read_csv(
              fp, compression="gzip", header=None
          ).values
  
      with pathlib.Path(split_path).open("rb") as fp:
          self._split_idx = pd.read_csv(
              fp, compression="gzip", header=None
          ).values.T[0]
  
      self._repeat = False
      self._batch_size = batch_size
      self._generator = self._make_generator()
      self._max_nodes = int(np.max(self._n_node))
      self._max_edges = int(np.max(self._n_edge))
  
      if dynamically_batch:
          self._generator = jraph.dynamically_batch(
              self._generator,
              # Plus one for the extra padding node.
              n_node=self._batch_size * (self._max_nodes) + 1,
              # Times two because we want backwards edges.
              n_edge=self._batch_size * (self._max_edges) * 2,
              n_graph=self._batch_size + 1,
          )
  
      # If n_node = [1,2,3], we create accumulated n_node [0,1,3,6] for indexing.
      self._accumulated_n_nodes = np.concatenate(
          (np.array([0]), np.cumsum(self._n_node))
      )
      # Same for n_edge
      self._accumulated_n_edges = np.concatenate(
          (np.array([0]), np.cumsum(self._n_edge))
      )
      self._dynamically_batch = dynamically_batch
  
file_path: jraph/jraph/ogb_examples/data_utils.py
imports: import pathlib
  import jraph
  import numpy
  import pandas
label_desc: Use image node_id 1 to create a new DataReader object  with example: obj = DataReader(data_path, master_csv_path, split_path, batch_size, dynamically_batch)