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 = Variable(torch.LongTensor(batch_size).random_(n_classes))

    _, pred = torch.max(output, dim=1)
    preds.append(pred.data)
    targets.append(target.data)

preds = torch.cat(preds)
targets = torch.cat(targets)

Or you could of course cast them to numpy arrays, if you would like to calculate statistics using another framework.