Your first approach would reinitialize your model, so I assume this won’t work, as you are not testing your trained model.
The second approach looks alright. Could you check the data type of (pred_labels != test_labels) and make sure the sum does not overflow?
This shouldn’t be the case in the current stable release, but might be a problem, if you are using an old PyTorch version.