code: def main():
      parser = argparse.ArgumentParser(
          description="OGBL-Citation2 (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("--std", type=float, default=0.2)
      parser.add_argument("--hidden_channels", type=int, default=128)
      parser.add_argument("--dropout", type=float, default=0.5)
      parser.add_argument("--batch_size", type=int, default=64 * 1024)
      parser.add_argument("--lr", type=float, default=0.01)
      parser.add_argument("--epochs", type=int, default=300)
      parser.add_argument("--eval_steps", type=int, default=10)
      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-citation2")
      split_edge = dataset.get_edge_split()
      data = dataset[0]
  
      # We randomly pick some training samples that we want to evaluate on:
      torch.manual_seed(12345)
      idx = torch.randperm(split_edge["train"]["source_node"].numel())[
          :86596
      ]
      split_edge["eval_train"] = {
          "source_node": split_edge["train"]["source_node"][idx],
          "target_node": split_edge["train"]["target_node"][idx],
          "target_node_neg": split_edge["valid"]["target_node_neg"],
      }
  
      emb = torch.nn.Embedding(data.num_nodes, 96).to(device)
      predictor = LinkPredictor(
          96, args.hidden_channels, 1, args.num_layers, args.dropout
      ).to(device)
  
      evaluator = Evaluator(name="ogbl-citation2")
      logger = Logger(args.runs, args)
  
      for run in range(args.runs):
          torch.nn.init.normal_(emb.weight, std=args.std)
          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(
                  predictor,
                  emb.weight,
                  split_edge,
                  optimizer,
                  args.batch_size,
              )
  
              if epoch % args.eval_steps == 0:
                  result = test(
                      predictor,
                      emb.weight,
                      split_edge,
                      evaluator,
                      args.batch_size,
                  )
                  logger.add_result(run, result)
  
                  if epoch % args.log_steps == 0:
                      train_mrr, valid_mrr, test_mrr = result
                      print(
                          f"Run: {run + 1:02d}, "
                          f"Epoch: {epoch:02d}, "
                          f"Loss: {loss:.4f}, "
                          f"Train: {train_mrr:.4f}, "
                          f"Valid: {valid_mrr:.4f}, "
                          f"Test: {test_mrr:.4f}"
                      )
  
          print("MF")
          logger.print_statistics(run)
  
      print("MF")
      logger.print_statistics()
  
file_path: ogb/examples/linkproppred/citation2/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