code: def test(dataset, model, epoch, args):
      u_batch_size = args.test_batch_size
      testDict = dataset.testDict
      model.eval()
      topks = eval(args.topks)
      max_K = max(topks)
      results = {
          "precision": np.zeros(len(topks)),
          "recall": np.zeros(len(topks)),
          "ndcg": np.zeros(len(topks)),
      }
      users = list(testDict.keys())
      users_list = []
      rating_list = []
      groundTrue_list = []
      total_batch = len(users) // u_batch_size + 1
      for batch_users in tqdm(
          minibatch(users, batch_size=u_batch_size)
      ):
          allPos = dataset.getUserPosItems(batch_users)
          groundTrue = [testDict[u] for u in batch_users]
          batch_users_gpu = paddle.to_tensor(batch_users, dtype="int64")
          rating = model.getUsersRating(batch_users_gpu)
          exclude_index = []
          exclude_items = []
  
          for range_i, items in enumerate(allPos):
              exclude_index.extend([range_i] * len(items))
              items = [int(i) for i in items]
              exclude_items.extend(items)
          rating[exclude_index, exclude_items] = -(1 << 10)
          _, rating_K = paddle.topk(rating, k=max_K)
          rating = rating.numpy()
          del rating
          users_list.append(batch_users)
          rating_list.append(rating_K.cpu())
          groundTrue_list.append(groundTrue)
  
      assert total_batch == len(users_list)
      X = zip(rating_list, groundTrue_list)
      pre_results = []
      for x in X:
          pre_results.append(test_one_batch(x, topks))
      scale = float(u_batch_size / len(users))
      for result in pre_results:
          results["recall"] += result["recall"]
          results["precision"] += result["precision"]
          results["ndcg"] += result["ndcg"]
      results["recall"] /= float(len(users))
      results["precision"] /= float(len(users))
      results["ndcg"] /= float(len(users))
      # results['auc'] = np.mean(auc_record)
      return results
  
file_path: PGL/examples/lightgcn/train.py
imports: import pgl
  import paddle
  import paddle.nn
  from dataloader import Loader
  from model import *
  from utils import *
  import numpy
  import paddle
  import paddle.nn
  import paddle.nn.functional
  import time
  import multiprocessing
  from tqdm import tqdm
  from time import time
  import argparse
label_desc: Use image node_id 3 for calling a global function with example usage: test(dataset, model, epoch, args) and returns: results