(preds, labels)
| 9 | |
| 10 | # compute the current classification accuracy |
| 11 | def compute_acc(preds, labels): |
| 12 | correct = 0 |
| 13 | preds_ = preds.data.max(1)[1] |
| 14 | correct = preds_.eq(labels.data).cpu().sum() |
| 15 | acc = float(correct) / float(len(labels.data)) * 100.0 |
| 16 | return acc |