code: def test():
      network.eval()
      test_loss = 0
      correct = 0
      with torch.no_grad():
          for data, target in test_loader:
              output = network(data)
              test_loss += F.nll_loss(
                  output, target, size_average=False
              ).item()
              pred = output.data.max(1, keepdim=True)[1]
              correct += pred.eq(target.data.view_as(pred)).sum()
      test_loss /= len(test_loader.dataset)
      test_losses.append(test_loss)
      print(
          "\nTest set: Avg. loss: {:.4f}, Accuracy: {}/{} ({:.0f}%)\n".format(
              test_loss,
              correct,
              len(test_loader.dataset),
              old_div(100.0 * correct, len(test_loader.dataset)),
          )
      )
  
file_path: AdvBox/DataPoison/poison_mnist_pytorch.py
imports: from __future__ import division
  from __future__ import print_function
  from builtins import range
  from past.utils import old_div
  import torch
  import torchvision
  import torch.nn
  import torch.nn.functional
  import torch.optim
label_desc: Use image node_id 2 for calling a global function with example usage: test() without return types