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)
  
      if args.to_undirected:
          inv_edge_index = (g.edges()[1], g.edges()[0])
          g = dgl.add_edges(g, inv_edge_index[0], inv_edge_index[1])
          # adj = to_undirected(edge_index, num_nodes=data[0]['num_nodes'])
          print("convert the input graph to undirected graph")
  
      # add self loop
      # no duplicate self loop will be added for nodes already having self loops
      new_g = dgl.transform.add_self_loop(g)
  
      adj = torch.stack(g.edges())
  
      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,
          "adj": adj,
      }
  
      return data
  
imports: import argparse
  import os
  import time
  import warnings
  from collections import namedtuple
  import dgl
  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
  from ...data.data import GraphData
  from ...modules.graph_embedding_learning.gcn import GCN
  from ...modules.utils.generic_utils import EarlyStopping, get_config, grid, print_config
label_desc: Use image node_id 4 for calling a global function with example usage: prepare_ogbn_graph_data(args) and returns: data