code: def test(args, 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)
              # sum up batch loss
              test_loss += F.nll_loss(
                  output, target, reduction="sum"
              ).item()
              # get the index of the max log-probability
              pred = output.argmax(dim=1, keepdim=True)
              correct += pred.eq(target.view_as(pred)).sum().item()
  
      test_loss /= len(test_loader.dataset)
      print("\n")
      print(
          "Test set: Average loss: {:.4f}, Accuracy: {}/{} ({:.0f}%)\n".format(
              test_loss,
              correct,
              len(test_loader.dataset),
              100.0 * correct / len(test_loader.dataset),
          )
      )
      # Use MLflow logging
      mlflow.log_metric("average_loss", test_loss)
  
file_path: MachineLearningNotebooks/how-to-use-azureml/ml-frameworks/using-mlflow/train-and-deploy-pytorch/scripts/train.py
imports: import mlflow
  import mlflow.pytorch
  from mlflow.utils.environment import _mlflow_conda_env
  import warnings
  import cloudpickle
  import torch
  import torch.nn
  import torch.nn.functional
  import torch.optim
  import torchvision
  from torchvision import datasets, transforms
label_desc: Use image node_id 2 for calling a global function with example usage: test(args, model, device, test_loader) without return types