(pred, target)
| 48 | |
| 49 | # Calculate accuracy |
| 50 | def accuracy(pred, target): |
| 51 | # y is network output to be compared with ground truth (int) |
| 52 | y = np.argmax(pred, axis=1) |
| 53 | a = y == target |
| 54 | correct = np.array(a, "int").sum() |
| 55 | return correct |
| 56 | |
| 57 | |
| 58 | # Data partition according to the rank |