code: def evaluate(model, loader, criterion):
      model.eval()
      total_loss = []
      total_acc = []
  
      for idx, batch_data in enumerate(loader):
          graphs, labels = batch_data
          g = pgl.Graph.batch(graphs).tensor()
          labels = paddle.to_tensor(labels)
  
          pred = model(g)
          eval_loss = criterion(pred, labels)
          eval_acc = paddle.metric.accuracy(
              input=pred, label=labels, k=1
          )
          total_loss.append(eval_loss.numpy())
          total_acc.append(eval_acc.numpy())
  
      total_loss = np.mean(total_loss)
      total_acc = np.mean(total_acc)
      model.train()
  
      return {"loss": total_loss, "acc": total_acc}
  
file_path: PGL/examples/gin/main.py
imports: import os
  import sys
  import time
  import argparse
  import numpy
  import paddle
  import paddle.nn
  from paddle.optimizer import Adam
  import pgl
  from pgl.utils.logger import log
  from pgl.utils.data import Dataloader
  from dataset import GINDataset, fold10_split, random_split, collate_fn
  from model import GINModel
label_desc: Use image node_id 2 for calling a global function with example usage: evaluate(model, loader, criterion) and returns: dict