code: def prepare_ogbn_graph_data(args):
      from ogb.nodeproppred import DglNodePropPredDataset
  
      dataset = DglNodePropPredDataset(name=args.dataset)
  
      split_idx = dataset.get_idx_split()
      train_idx, val_idx, test_idx = (
          torch.LongTensor(split_idx["train"]),
          torch.LongTensor(split_idx["valid"]),
          torch.LongTensor(split_idx["test"]),
      )
      g, labels = dataset[
          0
      ]  # graph: dgl graph object, label: torch tensor of shape (num_nodes, num_tasks)
      features = torch.Tensor(g.ndata["feat"])
      labels = torch.LongTensor(labels).squeeze(-1)
  
      # add self loop
      # no duplicate self loop will be added for nodes already having self loops
      new_g = dgl.transform.add_self_loop(g)
  
      # edge_index = data[0]['edge_index']
      # adj = to_undirected(edge_index, num_nodes=data[0]['num_nodes'])
      # assert adj.diagonal().sum() == 0 and adj.max() <= 1 and (adj != adj.transpose()).sum() == 0
  
      num_feats = features.shape[1]
      n_classes = labels.max().item() + 1
      n_edges = new_g.number_of_edges()
      print(
          """----Data statistics------'
        #Edges %d
        #Classes %d
        #Train samples %d
        #Val samples %d
        #Test samples %d"""
          % (
              n_edges,
              n_classes,
              train_idx.shape[0],
              val_idx.shape[0],
              test_idx.shape[0],
          )
      )
  
      data = {
          "features": features,
          "graph": new_g,
          "train_mask": train_idx,
          "val_mask": val_idx,
          "test_mask": test_idx,
          "labels": labels,
          "num_feats": num_feats,
          "n_classes": n_classes,
          "n_edges": n_edges,
      }
  
      return data
  
imports: import argparse
  import os
  import time
  import dgl
  import dgl.function
  import networkx
  import numpy
  import torch
  import torch.backends.cudnn
  import torch.nn
  import torch.nn.functional
  from dgl import DGLGraph
  from dgl.data import load_data, register_data_args
  from scipy import sparse
  from ...modules.graph_construction import NodeEmbeddingBasedGraphConstruction, NodeEmbeddingBasedRefinedGraphConstruction
  from ...modules.utils.vocab_utils import VocabModel
  from ..utils import EarlyStopping
label_desc: Use image node_id 4 for calling a global function with example usage: prepare_ogbn_graph_data(args) and returns: data