MCPcopy Create free account
hub / github.com/LAMDA-CL/CVPR22-Fact / Timer

Class Timer

utils.py:61–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59
60
61class 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
76def count_acc(logits, label):

Callers 2

__init__Method · 0.90
__init__Method · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected