code: def load_mag240m(root="dataset"):
      from os.path import join
  
      import numpy as np
      from ogb.lsc import MAG240MDataset
  
      dataset = MAG240MDataset(root=root)
  
      print("Loading graph")
      (g,), _ = dgl.load_graphs(
          join(root, "mag240m_kddcup2021/graph.dgl")
      )
  
      print("Loading features")
      paper_offset = dataset.num_authors + dataset.num_institutions
      num_nodes = paper_offset + dataset.num_papers
      num_features = dataset.num_paper_features
      feats = th.from_numpy(
          np.memmap(
              join(root, "mag240m_kddcup2021/full.npy"),
              mode="r",
              dtype="float16",
              shape=(num_nodes, num_features),
          )
      ).float()
      g.ndata["features"] = feats
      train_nid = (
          th.LongTensor(dataset.get_idx_split("train")) + paper_offset
      )
      val_nid = (
          th.LongTensor(dataset.get_idx_split("valid")) + paper_offset
      )
      test_nid = (
          th.LongTensor(dataset.get_idx_split("test-dev"))
          + paper_offset
      )
      train_mask = th.zeros((g.number_of_nodes(),), dtype=th.bool)
      train_mask[train_nid] = True
      val_mask = th.zeros((g.number_of_nodes(),), dtype=th.bool)
      val_mask[val_nid] = True
      test_mask = th.zeros((g.number_of_nodes(),), dtype=th.bool)
      test_mask[test_nid] = True
      g.ndata["train_mask"] = train_mask
      g.ndata["val_mask"] = val_mask
      g.ndata["test_mask"] = test_mask
      labels = th.tensor(dataset.paper_label)
      num_labels = len(
          th.unique(labels[th.logical_not(th.isnan(labels))])
      )
      g.ndata["labels"] = -th.ones(g.number_of_nodes(), dtype=th.int64)
      g.ndata["labels"][train_nid] = labels[
          train_nid - paper_offset
      ].long()
      g.ndata["labels"][val_nid] = labels[val_nid - paper_offset].long()
      return g, num_labels
  
file_path: dgl/examples/pytorch/labor/load_graph.py
imports: import dgl
  import torch
label_desc: Use image node_id 4 for calling a global function with example usage: load_mag240m(root) and returns: g,  num_labels