code: def test(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)
              test_loss += F.nll_loss(
                  output, target, reduction="sum"
              ).item()  # sum up batch loss
              pred = output.argmax(
                  dim=1, keepdim=True
              )  # get the index of the max log-probability
              correct += pred.eq(target.view_as(pred)).sum().item()
  
      test_loss /= len(test_loader.dataset)
      wandb.log(
          {
              "test_loss": test_loss,
              "accuracy": correct / len(test_loader.dataset),
          }
      )
  
imports: import os
  from pathlib import Path
  import torch
  import torch.nn
  import torch.nn.functional
  import torch.optim
  import wandb
  from metaflow import FlowSpec, Parameter, step
  from torch.optim.lr_scheduler import StepLR
  from torchvision import datasets, transforms
  from wandb.integration.metaflow import wandb_log
label_desc: Use image node_id 2 for calling a global function with example usage: test(model, device, test_loader) without return types