def compute_accuracy(model, data_loader, train=False, validation=False):
    correct_pred, num_examples = 0, 0
    model.eval()
    for i, (features, targets) in enumerate(data_loader):

        features = features.to(device)
        targets = targets.to(device)

        logits = model(features)
        y_pred = logits.max(1)[1]

        num_examples += targets.size(0)
        correct_pred += (y_pred == targets).float().sum()
    return correct_pred.float() / num_examples * 100

results are:
first:
tensor(81.4359, device='cuda:0')
tensor(75.7375, device='cuda:0'

second time:
tensor(81.4284, device='cuda:0')
tensor(75.7506, device='cuda:0')