code: def main():
      # check cuda
      device = (
          f"cuda:{args.gpu}"
          if args.gpu >= 0 and torch.cuda.is_available()
          else "cpu"
      )
  
      # load ogb dataset & evaluator
      dataset = DglGraphPropPredDataset(name="ogbg-molhiv")
      evaluator = Evaluator(name="ogbg-molhiv")
  
      g, _ = dataset[0]
      node_feat_dim = g.ndata["feat"].size()[-1]
      edge_feat_dim = g.edata["feat"].size()[-1]
      n_classes = dataset.num_tasks
  
      split_idx = dataset.get_idx_split()
      train_loader = DataLoader(
          dataset[split_idx["train"]],
          batch_size=args.batch_size,
          shuffle=True,
          collate_fn=collate_dgl,
      )
      valid_loader = DataLoader(
          dataset[split_idx["valid"]],
          batch_size=args.batch_size,
          shuffle=False,
          collate_fn=collate_dgl,
      )
      test_loader = DataLoader(
          dataset[split_idx["test"]],
          batch_size=args.batch_size,
          shuffle=False,
          collate_fn=collate_dgl,
      )
  
      # load model
      model = DeeperGCN(
          node_feat_dim=node_feat_dim,
          edge_feat_dim=edge_feat_dim,
          hid_dim=args.hid_dim,
          out_dim=n_classes,
          num_layers=args.num_layers,
          dropout=args.dropout,
          learn_beta=args.learn_beta,
      ).to(device)
  
      print(model)
  
      opt = optim.Adam(model.parameters(), lr=args.lr)
      loss_fn = nn.BCEWithLogitsLoss()
  
      # training & validation & testing
      best_auc = 0
      best_model = copy.deepcopy(model)
      times = []
  
      print("---------- Training ----------")
      for i in range(args.epochs):
          t1 = time.time()
          train_loss = train(model, device, train_loader, opt, loss_fn)
          t2 = time.time()
  
          if i >= 5:
              times.append(t2 - t1)
  
          train_auc = test(model, device, train_loader, evaluator)
          valid_auc = test(model, device, valid_loader, evaluator)
  
          print(
              f"Epoch {i} | Train Loss: {train_loss:.4f} | Train Auc: {train_auc:.4f} | Valid Auc: {valid_auc:.4f}"
          )
  
          if valid_auc > best_auc:
              best_auc = valid_auc
              best_model = copy.deepcopy(model)
  
      print("---------- Testing ----------")
      test_auc = test(best_model, device, test_loader, evaluator)
      print(f"Test Auc: {test_auc}")
      if len(times) > 0:
          print("Times/epoch: ", sum(times) / len(times))
  
file_path: dgl/examples/pytorch/deepergcn/main.py
imports: import argparse
  import copy
  import time
  import torch
  import torch.nn
  import torch.optim
  from models import DeeperGCN
  from ogb.graphproppred import collate_dgl, DglGraphPropPredDataset, Evaluator
  from torch.utils.data import DataLoader
label_desc: Use image node_id 3 for calling a global function with example usage: main() without return types