These two lines of code are from the testing of a CNN model. I know of alternative ways of getting the predictions and correct predictions
but I have struggled to make sense of the two lines below:
  pred = output.data.max(1, keepdim=True)[1]
  correct += pred.eq(target.data.view_as(pred)).sum()