text: from __future__ import print_function
  import os
  import argparse
  import torch
  import torch.nn as nn
  import torch.nn.functional as F
  import torch.optim as optim
  from torchvision import datasets, transforms
  from torch.autograd import Variable
  
  from vgg import vgg
  import shutil
  
  # Training settings
  parser = argparse.ArgumentParser(description='PyTorch Slimming CIFAR training')
  parser.add_argument('--dataset', type=str, default='cifar10',
                      help='training dataset (default: cifar10)')
  parser.add_argument('--model', default='', type=str, metavar='PATH',
                      help='model for evaluation')
  parser.add_argument('--test-batch-size', type=int, default=1000, metavar='N',
                      help='input batch size for testing (default: 1000)')
  parser.add_argument('--no-cuda', action='store_true', default=False,
                      help='disables CUDA training')
  args = parser.parse_args()
  args.cuda = not args.no_cuda and torch.cuda.is_available()
  
  kwargs = {'num_workers': 1, 'pin_memory': True} if args.cuda else {}
  device = torch.device("cuda" if args.cuda else "cpu")
  test_loader = torch.utils.data.DataLoader(
      datasets.CIFAR10('./data', train=False, transform=transforms.Compose([
                         transforms.ToTensor(),
                         transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))
                     ])),
      batch_size=args.test_batch_size, shuffle=True, **kwargs)
  
  checkpoint = torch.load(args.model)
  model = vgg(cfg=checkpoint['cfg'])
  model.load_state_dict(checkpoint['state_dict'])
  model.to(device)
  
  def test():
      model.eval()
      test_loss = 0
      correct = 0
      for data, target in test_loader:
          data, target = data.to(device), target.to(device)
          output = model(data)
          # test_loss += F.cross_entropy(output, target, size_average=False).data # sum up batch loss
          test_loss += F.cross_entropy(output, target, reduction='sum').item()
          pred = output.max(1, keepdim=True)[1] # get the index of the max log-probability
          correct += pred.eq(target.view_as(pred)).sum().item()
  
      test_loss /= len(test_loader.dataset)
      print('\nTest set: Average loss: {:.4f}, Accuracy: {}/{} ({:.1f}%)\n'.format(
          test_loss, correct, len(test_loader.dataset),
          100. * correct / len(test_loader.dataset)))
      return correct / float(len(test_loader.dataset))
  
  test()