code: def train_loop(
      parser,
      start_program,
      main_program,
      test_p_list,
      model,
      feat_init,
      place,
      dataset,
      split_idx,
      exe,
      run_id,
      wf=None,
  ):
      # build up training program
      exe.run(start_program)
      feat_init(place)
  
      max_acc = 0  # best test_acc
      max_step = 0  # step for best test_acc
      max_val_acc = 0  # best val_acc
      max_cor_acc = 0  # test_acc for best val_acc
      max_cor_step = 0  # step for best val_acc
      # training loop
  
      for epoch_id in range(parser.epochs):
          # start training
  
          if parser.use_label_e:
              train_idx_temp = copy.deepcopy(split_idx["train"])
              np.random.shuffle(train_idx_temp)
              label_idx = train_idx_temp[
                  : int(parser.label_rate * len(train_idx_temp))
              ]
              unlabel_idx = train_idx_temp[
                  int(parser.label_rate * len(train_idx_temp)) :
              ]
              train_gg = SampleDataGenerator(
                  graph_wrappers=model.gw_list,
                  buf_size=parser.buf_size,
                  batch_size=parser.batch_size,
                  num_workers=parser.num_workers,
                  sizes=parser.sizes,
                  shuffle=True,
                  dataset=dataset,
                  nodes_idx=unlabel_idx,
              )
              pbar = tqdm(total=unlabel_idx.shape[0])
              pbar.set_description(f"Epoch {epoch_id:02d}")
  
              total = 0.0
              acc_num = 0.0
              for batch_feed in tqdm(train_gg.generator()):
                  batch_feed["label_idx"] = label_idx
                  loss = exe.run(
                      main_program,
                      feed=batch_feed,
                      fetch_list=[model.avg_cost, model.out_feat],
                  )
                  total += loss[0][0]
  
                  acc_num = (
                      loss[1].argmax(axis=-1)
                      == batch_feed["label"].reshape(-1)
                  ).sum() + acc_num
                  pbar.update(batch_feed["label"].shape[0])
              pbar.close()
              print(total / (len(train_gg) / parser.batch_size))
  
              print("acc: ", (acc_num / unlabel_idx.shape[0]) * 100)
  
          # eval result
          if (epoch_id + 1) >= 50 and (epoch_id + 1) % 10 == 0:
              result = eval_test(
                  parser, test_p_list, model, exe, dataset, split_idx
              )
              train_acc, valid_acc, test_acc = result
  
              max_acc = max(test_acc, max_acc)
              if max_acc == test_acc:
                  max_step = epoch_id
              max_val_acc = max(valid_acc, max_val_acc)
              if max_val_acc == valid_acc:
                  max_cor_acc = test_acc
                  max_cor_step = epoch_id
              max_acc = max(result[2], max_acc)
              if max_acc == result[2]:
                  max_step = epoch_id
              result_t = (
                  f"Run: {run_id:02d}, "
                  f"Epoch: {epoch_id:02d}, "
                  f"Loss: {total:.4f}, "
                  f"Train: {100 * train_acc:.2f}%, "
                  f"Valid: {100 * valid_acc:.2f}%, "
                  f"Test: {100 * test_acc:.2f}% \n"
                  f"max_Test: {100 * max_acc:.2f}%, "
                  f"max_step: {max_step}\n"
                  f"max_val: {100 * max_val_acc:.2f}%, "
                  f"max_val_Test: {100 * max_cor_acc:.2f}%, "
                  f"max_val_step: {max_cor_step}\n"
              )
              #         if (epoch_id+1)%50==0:
              print(result_t)
              wf.write(result_t)
              wf.write("\n")
              wf.flush()
      return max_cor_acc
  
imports: import math
  import torch
  import paddle
  import pgl
  import numpy
  import paddle.fluid
  import paddle.fluid.layers
  import copy
  from pgl.contrib.ogb.nodeproppred.dataset_pgl import PglNodePropPredDataset
  from ogb.nodeproppred import Evaluator
  from utils import to_undirected, add_self_loop, linear_warmup_decay
  from model import Products_label_embedding_model
  from dataloader.ogb_products_dataloader import SampleDataGenerator
  import paddle.fluid.profiler
  from pgl.utils import paddle_helper
  import argparse
  from tqdm import tqdm
label_desc: Use image node_id 4 for calling a global function with example usage: train_loop(parser, start_program, main_program, test_p_list, model, feat_init, place, dataset, split_idx, exe, run_id, wf) and returns: max_cor_acc