code: def test(epoch):
      model.eval()
      test_loss = 0
      correct = 0
      with torch.no_grad():
          for data, target in test_loader:
              if args.cuda:
                  data, target = data.cuda(), target.cuda()
              output = model(data)
              test_loss += F.nll_loss(
                  output, target, reduction="sum"
              ).data.item()  # sum up batch loss
              # get the index of the max log-probability
              pred = output.data.max(1)[1]
              correct += pred.eq(target.data).cpu().sum().item()
  
      test_loss /= len(test_loader.dataset)
      test_accuracy = 100.0 * correct / len(test_loader.dataset)
      print(
          "\nTest set: Average loss: {:.4f}, Accuracy: {}/{} ({:.0f}%)\n".format(
              test_loss,
              correct,
              len(test_loader.dataset),
              test_accuracy,
          )
      )
      step = (epoch + 1) * len(train_loader)
      log_scalar("test_loss", test_loss, step)
      log_scalar("test_accuracy", test_accuracy, step)
  
file_path: BentoML/examples/mlflow/pytorch/mnist.py
imports: import argparse
  import os
  import mlflow
  import mlflow.pytorch
  import torch
  import torch.nn
  import torch.nn.functional
  import torch.optim
  from torchvision import datasets
  from torchvision import transforms
  import bentoml
label_desc: Use image node_id 2 for calling a global function with example usage: test(epoch) without return types