| 59 | |
| 60 | |
| 61 | class Timer(): |
| 62 | |
| 63 | def __init__(self): |
| 64 | self.o = time.time() |
| 65 | |
| 66 | def measure(self, p=1): |
| 67 | x = (time.time() - self.o) / p |
| 68 | x = int(x) |
| 69 | if x >= 3600: |
| 70 | return '{:.1f}h'.format(x / 3600) |
| 71 | if x >= 60: |
| 72 | return '{}m'.format(round(x / 60)) |
| 73 | return '{}s'.format(x) |
| 74 | |
| 75 | |
| 76 | def count_acc(logits, label): |