Solved by ptrblck in post #4 
              
              
                I would recommend to store all predictions and targets in a list (don’t forget to wrap this code in a with torch.no_grad() block or detach the predicitons) inside the loop. 
Once you’ve collected all predictions and the corresponding target, you could use sklearn.metrics.confusion_matrix (or search …