(pred, target)
| 136 | |
| 137 | # Calculate accuracy |
| 138 | def accuracy(pred, target): |
| 139 | # y is network output to be compared with ground truth (int) |
| 140 | y = np.argmax(pred, axis=1) |
| 141 | a = y == target |
| 142 | correct = np.array(a, "int").sum() |
| 143 | return correct |
| 144 | |
| 145 | |
| 146 | # Data partition according to the rank |