class_docstr: A class for saving graphs and split in OGB-compatible manner
  Create submission_datasetname/ directory, and output the following two files:
      - datasetname.zip (OGB-compatible zipped dataset folder)
      - meta_dict.pt (torch files storing all the necessary dataset meta-information)
class_docstr_tok: ["A","class","for","saving","graphs","and","split","in","OGB-compatible","manner","Create","submission_datasetname\/","directory",",","and","output","the","following","two","files",":","-","datasetname.zip","(","OGB-compatible","zipped","dataset","folder",")","-","meta_dict.pt","(","torch","files","storing","all","the","necessary","dataset","meta-information",")"]
docstr: target_label (numpy.narray): storing target labels. Shape must be (num_data, num_tasks)
docstr_tok: ["target_label","(","numpy.narray",")",":","storing","target","labels",".","Shape","must","be","(","num_data",",","num_tasks",")"]
code: def save_target_labels(self, target_labels):
      """
      target_label (numpy.narray): storing target labels. Shape must be (num_data, num_tasks)
      """
  
      if self.dataset_prefix == "ogbl":
          raise RuntimeError(
              "ogbl link prediction dataset does not need to call save_target_labels"
          )
  
      if not self._save_graph_list_done:
          raise RuntimeError("save_graph_list must be done beforehand.")
  
      if self.is_hetero:
          if not (
              isinstance(target_labels, dict)
              and len(target_labels) == 1
          ):
              raise ValueError(
                  f"target label must be of dictionary type with single key"
              )
  
          key = list(target_labels.keys())[0]
  
          if key not in self.num_data:
              raise ValueError(f"Unknown entity type called {key}.")
  
          if len(target_labels[key]) != self.num_data[key]:
              raise RuntimeError(
                  f"The length of target_labels ({len(target_labels[key])}) must be the same as the number of data points ({self.num_data[key]})."
              )
  
          if self.dataset_prefix == "ogbg":
              raise NotImplementedError(
                  "hetero graph for graph-level prediction has not been implemented yet."
              )
          elif self.dataset_prefix == "ogbn":
              np.savez_compressed(
                  osp.join(self.raw_dir, "node-label.npz"),
                  **target_labels,
              )
  
          self.num_tasks = target_labels[key].shape[1]
  
      else:
          # check type and shape
          if not isinstance(target_labels, np.ndarray):
              raise ValueError(
                  f"target label must be of type np.ndarray"
              )
  
          if len(target_labels) != self.num_data:
              raise RuntimeError(
                  f"The length of target_labels ({len(target_labels)}) must be the same as the number of data points ({self.num_data})."
              )
  
          if self.dataset_prefix == "ogbg":
              np.savez_compressed(
                  osp.join(self.raw_dir, "graph-label.npz"),
                  graph_label=target_labels,
              )
          elif self.dataset_prefix == "ogbn":
              np.savez_compressed(
                  osp.join(self.raw_dir, "node-label.npz"),
                  node_label=target_labels,
              )
  
          self.num_tasks = target_labels.shape[1]
  
      self._save_target_labels_done = True
  
imports: import torch
  import pandas
  import os
  import os.path
  from datetime import date
  import shutil
  from tqdm.auto import tqdm
  import numpy
  from ogb.io.read_graph_raw import read_binary_graph_raw, read_binary_heterograph_raw
  from ogb.utils.torch_util import all_numpy
label_desc: Use image node_id 5 for calling the DatasetSaver obj's underlying member method code with example usage: obj.save_target_labels(target_labels) without return types