code: def test_epoch(model, device, test_loader):
      model.eval()
      test_loss = 0
      correct = 0
      with torch.no_grad():
          for data, target in test_loader:
              data, target = data.to(device), target.to(device)
              output = model(data)
              pred = output.argmax(dim=1, keepdim=True)
              correct += pred.eq(target.view_as(pred)).sum().item()
  
      test_loss /= len(test_loader.dataset)
  
      accuracy = 100.0 * correct / len(test_loader.dataset)
  
      print(
          "\nTest set: Accuracy: {}/{} ({:.0f}%)\n".format(
              correct, len(test_loader.dataset), accuracy
          )
      )
  
      return accuracy
  
imports: import os
  import random
  from pathlib import Path
  import nni
  import torch
  import torch.nn.functional
  import nni.retiarii.nn.pytorch
  import nni.retiarii.strategy
  from nni.retiarii import model_wrapper
  from nni.retiarii.evaluator import FunctionalEvaluator
  from nni.retiarii.experiment.pytorch import RetiariiExeConfig, RetiariiExperiment, debug_mutated_model
  from torch.utils.data import DataLoader
  from torchvision import transforms
  from torchvision.datasets import MNIST
label_desc: Use image node_id 2 for calling a global function with example usage: test_epoch(model, device, test_loader) and returns: accuracy