code: def evaluate(model, data_loader, device):
      model.eval()
  
      # 验证样本总个数
      total_num = len(data_loader.dataset)
  
      # 用于存储预测正确的样本个数
      sum_num = torch.zeros(1).to(device)
  
      data_loader = tqdm(data_loader, file=sys.stdout)
  
      for step, data in enumerate(data_loader):
          images, labels = data
          pred = model(images.to(device))
          pred = torch.max(pred, dim=1)[1]
          sum_num += torch.eq(pred, labels.to(device)).sum()
  
      return sum_num.item() / total_num
  
file_path: deep-learning-for-image-processing/pytorch_classification/Test10_regnet/utils.py
imports: import os
  import sys
  import json
  import pickle
  import random
  import torch
  from tqdm import tqdm
  import matplotlib.pyplot
label_desc: Use image node_id 6 for calling a global function with example usage: evaluate(model, data_loader, device) and returns: unknown