Unable to get an image in the output when using MNIST Database using Pytorch
iter_test = 0

for images, labels in test_loader:

iter_test += 1

images = images.view(-1, 28*28)

outputs = model(images)
_, predicted = torch.max(outputs.data, 1)

if iter_test == 1:
    print('PREDICTION')
    print(predicted[0])

    print('LABEL SIZE')
    print(labels.size())

    print('LABEL FOR IMAGE 0')
    print(labels[0])


I get the output of this code as follows:


  
    PREDICTION
    
    tensor(7)
    
    LABEL SIZE
    
    torch.Size([100])
    
    LABEL FOR IMAGE 0
    
    tensor(7)
  


The code works perfectly. I was wondering if i could get the "MNIST" like image as output along with prediction?

Yes :). 

You can use pyplot and show the image loaded by test_loader. 

Check https://www.oreilly.com/learning/not-another-mnist-tutorial-with-tensorflow . 

Hope this helps!
