code: def model_test(exe, gw, gf, program, pred, inputs, args):
      """test model"""
      if args.inf_mode == "sep":
          # for inference mode 'sep', the type of step index is int.
          step_idx = args.n_pred - 1
          tmp_idx = [step_idx]
      elif args.inf_mode == "merge":
          # for inference mode 'merge', the type of step index is np.ndarray.
          step_idx = tmp_idx = np.arange(3, args.n_pred + 1, 3) - 1
          print(step_idx)
      else:
          raise ValueError(
              f'ERROR: test mode "{args.inf_mode}" is not defined.'
          )
  
      x_test, x_stats = inputs.get_data("test"), inputs.get_stats()
      y_test, len_test = multi_pred(
          exe,
          gw,
          gf,
          program,
          pred,
          x_test,
          args.batch_size,
          args.n_his,
          args.n_pred,
          step_idx,
      )
  
      # save result
      gt = x_test[0:len_test, args.n_his :, :, :].reshape(
          -1, args.n_route
      )
      y_pred = y_test.reshape(-1, args.n_route)
      city_df = pd.read_csv(args.city_file)
      city_df = city_df.drop(0)
  
      np.savetxt(
          os.path.join(args.output_path, "groundtruth.csv"),
          gt.astype(np.int32),
          fmt="%d",
          delimiter=",",
          header=",".join(city_df["city"]),
      )
      np.savetxt(
          os.path.join(args.output_path, "prediction.csv"),
          y_pred.astype(np.int32),
          fmt="%d",
          delimiter=",",
          header=",".join(city_df["city"]),
      )
  
      for i in range(step_idx + 1):
          evl = evaluation(
              x_test[0:len_test, step_idx + args.n_his, :, :],
              y_test[i],
              x_stats,
          )
          for ix in tmp_idx:
              te = evl[ix - 2 : ix + 1]
              print(
                  f"Time Step {i + 1}: MAPE {te[0]:7.3%}; MAE  {te[1]:4.3f}; RMSE {te[2]:6.3f}."
              )
  
file_path: PGL/legacy/examples/stgcn/models/tester.py
imports: import os
  import sys
  import time
  import argparse
  import numpy
  import pandas
  import paddle.fluid
  import paddle.fluid.layers
  import pgl
  from pgl.utils.logger import log
  from data_loader.data_utils import gen_batch
  from utils.math_utils import evaluation
label_desc: Use image node_id 3 for calling a global function with example usage: model_test(exe, gw, gf, program, pred, inputs, args) without return types