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