code: def test(dataloader, model, loss_fn):
      size = len(dataloader.dataset)
      num_batches = len(dataloader)
      model.eval()
      test_loss, correct = 0, 0
      with torch.no_grad():
          for X, y in dataloader:
              X, y = X.to(device), y.to(device)
              pred = model(X)
              test_loss += loss_fn(pred, y).item()
              correct += (
                  (pred.argmax(1) == y).type(torch.float).sum().item()
              )
      test_loss /= num_batches
      correct /= size
      print(
          f"Test Error: \n Accuracy: {(100*correct):>0.1f}%, Avg loss: {test_loss:>8f} \n"
      )
  
file_path: guildai/examples/pytorch-quickstart/train.py
imports: from binascii import crc32
  from itertools import chain
  import torch
  from torch import nn
  from torch.utils.data import DataLoader
  from torchvision import datasets
  from torchvision.transforms import ToTensor
label_desc: Use image node_id 2 for calling a global function with example usage: test(dataloader, model, loss_fn) without return types