Solved by ptrblck in post #4 
              
              
                It’s probably user’s preference, but I would remove the keepdims=True ans .view_as, like in my code.  
Ah ok, I understand. 
You could just store them in a list. 
preds = []
targets = []
for i in range(10):
    output = F.log_softmax(Variable(torch.randn(batch_size, n_classes)), dim=1)
    target = …