code: def main():
      parser = argparse.ArgumentParser(
          description="OGBN-papers100M (MLP)"
      )
      parser.add_argument("--device", type=int, default=0)
      parser.add_argument("--log_steps", type=int, default=1)
      parser.add_argument("--use_node_embedding", action="store_true")
      parser.add_argument("--use_sgc_embedding", action="store_true")
      parser.add_argument("--num_sgc_iterations", type=int, default=3)
      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)
      parser.add_argument("--lr", type=float, default=0.01)
      parser.add_argument("--batch_size", type=int, default=256)
      parser.add_argument("--epochs", type=int, default=30)
      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)
  
      if not args.use_sgc_embedding:
          try:
              data_dict = torch.load("data_dict.pt")
          except:
              raise RuntimeError(
                  "data_dict.pt not found. Need to run python node2vec.py first"
              )
          x = data_dict["node_feat"]
          split_idx = data_dict["split_idx"]
          y = data_dict["label"].to(torch.long)
  
          if args.use_node_embedding:
              x = torch.cat(
                  [x, data_dict["node2vec_embedding"]], dim=-1
              )
  
          print(x.shape)
  
      else:
          if args.use_node_embedding:
              raise ValueError(
                  "No option to use node embedding and sgc embedding at the same time."
              )
          else:
              try:
                  sgc_dict = torch.load("sgc_dict.pt")
              except:
                  raise RuntimeError(
                      "sgc_dict.pt not found. Need to run python sgc.py first"
                  )
  
              x = sgc_dict["sgc_embedding"][args.num_sgc_iterations]
              split_idx = sgc_dict["split_idx"]
              y = sgc_dict["label"].to(torch.long)
  
      train_dataset = SimpleDataset(
          x[split_idx["train"]], y[split_idx["train"]]
      )
      valid_dataset = SimpleDataset(
          x[split_idx["valid"]], y[split_idx["valid"]]
      )
      test_dataset = SimpleDataset(
          x[split_idx["test"]], y[split_idx["test"]]
      )
  
      train_loader = DataLoader(
          train_dataset, batch_size=args.batch_size, shuffle=True
      )
      valid_loader = DataLoader(
          valid_dataset, batch_size=128, shuffle=False
      )
      test_loader = DataLoader(
          test_dataset, batch_size=128, shuffle=False
      )
  
      model = MLP(
          x.size(-1),
          args.hidden_channels,
          172,
          args.num_layers,
          args.dropout,
      ).to(device)
  
      evaluator = Evaluator(name="ogbn-papers100M")
      logger = Logger(args.runs, args)
  
      for run in range(args.runs):
          model.reset_parameters()
          optimizer = torch.optim.Adam(model.parameters(), lr=args.lr)
          for epoch in range(1, 1 + args.epochs):
              train(model, device, train_loader, optimizer)
              train_acc = test(model, device, train_loader, evaluator)
              valid_acc = test(model, device, valid_loader, evaluator)
              test_acc = test(model, device, test_loader, evaluator)
  
              logger.add_result(run, (train_acc, valid_acc, test_acc))
  
              if epoch % args.log_steps == 0:
                  print(
                      f"Run: {run + 1:02d}, "
                      f"Epoch: {epoch:02d}, "
                      f"Train: {100 * train_acc:.2f}%, "
                      f"Valid: {100 * valid_acc:.2f}%, "
                      f"Test: {100 * test_acc:.2f}%"
                  )
  
          logger.print_statistics(run)
      logger.print_statistics()
  
file_path: ogb/examples/nodeproppred/papers100M/mlp.py
imports: import argparse
  from tqdm.auto import tqdm
  import torch
  import torch.nn.functional
  from torch.utils.data import Dataset, DataLoader
  from ogb.nodeproppred import Evaluator
  from logger import Logger
label_desc: Use image node_id 3 for calling a global function with example usage: main() without return types