code: def test(model, device, test_loader):
      model.eval()
      test_loss, correct = 0, 0
      with torch.no_grad():
          for data, target in test_loader:
              data, target = data.to(device), target.to(device)
              output = model(data)
              test_loss += F.nll_loss(
                  output, target, reduction="sum"
              ).item()
              pred = output.argmax(dim=1, keepdim=True)
              correct += pred.eq(target.view_as(pred)).sum().item()
      print(
          "\nTest set: Average loss: {:.4f}, Accuracy: {}/{} ({:.0f}%)\n".format(
              test_loss / len(test_loader.dataset),
              correct,
              len(test_loader.dataset),
              100.0 * correct / len(test_loader.dataset),
          )
      )
  
file_path: fastai/nbs/examples/migrating_pytorch.py
imports: import torch
  from torch import nn
  import torch.nn.functional
  from torch.utils.data import DataLoader
  from torchvision import datasets, transforms
label_desc: Use image node_id 2 for calling a global function with example usage: test(model, device, test_loader) without return types