code: def test_func(model, data_loader):
      device = torch.device(
          "cuda" if torch.cuda.is_available() else "cpu"
      )
      model.eval()
      correct = 0
      total = 0
      with torch.no_grad():
          for batch_idx, (data, target) in enumerate(data_loader):
              # We set this just for the example to run quickly.
              if batch_idx * len(data) > TEST_SIZE:
                  break
              data, target = data.to(device), target.to(device)
              outputs = model(data)
              _, predicted = torch.max(outputs.data, 1)
              total += target.size(0)
              correct += (predicted == target).sum().item()
  
      return correct / total
  
file_path: ray/python/ray/tune/tests/tutorial.py
imports: import numpy
  import torch
  import torch.optim
  import torch.nn
  from torchvision import datasets, transforms
  from torch.utils.data import DataLoader
  import torch.nn.functional
  from ray import train, tune
  from ray.tune.schedulers import ASHAScheduler
  from hyperopt import hp
  from ray.tune.search.hyperopt import HyperOptSearch
  import os
  from ray.tune.examples.mnist_pytorch_trainable import TrainMNIST
label_desc: Use image node_id 2 for calling a global function with example usage: test_func(model, data_loader) and returns: unknown