Created
          January 22, 2020 12:57 
        
      - 
      
- 
        Save vsay01/31fd0bd7a49b98bbb823a0249b38c37b to your computer and use it in GitHub Desktop. 
    Make prediction
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | test_acc = 0.0 | |
| for samples, labels in loaders['test']: | |
| with torch.no_grad(): | |
| samples, labels = samples.cuda(), labels.cuda() | |
| output = trained_model(samples) | |
| # calculate accuracy | |
| pred = torch.argmax(output, dim=1) | |
| correct = pred.eq(labels) | |
| test_acc += torch.mean(correct.float()) | |
| print('Accuracy of the network on {} test images: {}%'.format(len(testset), round(test_acc.item()*100.0/len(loaders['test']), 2))) | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment