code: def main():
      parser = argparse.ArgumentParser(description="OGBL-PPA (MF)")
      parser.add_argument("--device", type=int, default=0)
      parser.add_argument("--log_steps", type=int, default=1)
      parser.add_argument("--num_layers", type=int, default=3)
      parser.add_argument("--hidden_channels", type=int, default=256)
      parser.add_argument("--dropout", type=float, default=0.0)
      parser.add_argument("--batch_size", type=int, default=64 * 1024)
      parser.add_argument("--lr", type=float, default=0.005)
      parser.add_argument("--epochs", type=int, default=1000)
      parser.add_argument("--eval_steps", type=int, default=1)
      parser.add_argument("--runs", type=int, default=10)
      args = parser.parse_args()
      print(args)
  
      device = (
          f"cuda:{args.device}" if torch.cuda.is_available() else "cpu"
      )
      device = torch.device(device)
  
      dataset = PygLinkPropPredDataset(name="ogbl-ppa")
      split_edge = dataset.get_edge_split()
      data = dataset[0]
  
      emb = torch.nn.Embedding(data.num_nodes, args.hidden_channels).to(
          device
      )
  
      predictor = LinkPredictor(
          args.hidden_channels,
          args.hidden_channels,
          1,
          args.num_layers,
          args.dropout,
      ).to(device)
  
      evaluator = Evaluator(name="ogbl-ppa")
      loggers = {
          "Hits@10": Logger(args.runs, args),
          "Hits@50": Logger(args.runs, args),
          "Hits@100": Logger(args.runs, args),
      }
  
      for run in range(args.runs):
          emb.reset_parameters()
          predictor.reset_parameters()
          optimizer = torch.optim.Adam(
              list(emb.parameters()) + list(predictor.parameters()),
              lr=args.lr,
          )
  
          for epoch in range(1, 1 + args.epochs):
              loss = train(
                  emb.weight,
                  predictor,
                  split_edge,
                  optimizer,
                  args.batch_size,
              )
  
              if epoch % args.eval_steps == 0:
                  results = test(
                      emb.weight,
                      predictor,
                      split_edge,
                      evaluator,
                      args.batch_size,
                  )
                  for key, result in results.items():
                      loggers[key].add_result(run, result)
  
                  if epoch % args.log_steps == 0:
                      for key, result in results.items():
                          train_hits, valid_hits, test_hits = result
                          print(key)
                          print(
                              f"Run: {run + 1:02d}, "
                              f"Epoch: {epoch:02d}, "
                              f"Loss: {loss:.4f}, "
                              f"Train: {100 * train_hits:.2f}%, "
                              f"Valid: {100 * valid_hits:.2f}%, "
                              f"Test: {100 * test_hits:.2f}%"
                          )
  
          for key in loggers.keys():
              print(key)
              loggers[key].print_statistics(run)
  
      for key in loggers.keys():
          print(key)
          loggers[key].print_statistics()
  
file_path: ogb/examples/linkproppred/ppa/mf.py
imports: import argparse
  import torch
  import torch.nn.functional
  from torch.utils.data import DataLoader
  from ogb.linkproppred import PygLinkPropPredDataset, Evaluator
  from logger import Logger
label_desc: Use image node_id 3 for calling a global function with example usage: main() without return types