(pred, target)
| 55 | |
| 56 | # Calculate Accuracy |
| 57 | def accuracy(pred, target): |
| 58 | # y is network output to be compared with ground truth (int) |
| 59 | y = np.argmax(pred, axis=1) |
| 60 | a = y == target |
| 61 | correct = np.array(a, "int").sum() |
| 62 | # print(correct) |
| 63 | return correct |
| 64 | |
| 65 | |
| 66 | # Data partition according to the rank |