MCPcopy Create free account
hub / github.com/InternScience/InternAgent / Timer

Class Timer

tasks/AutoPower/code/src/utils.py:90–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

88
89
90class Timer:
91 def __init__(self, rest_epochs):
92 self.elapsed_time = None
93 self.rest_epochs = rest_epochs
94 self.eta = None # Estimated Time of Arrival
95
96 def __enter__(self):
97 self.start_time = time.time()
98 return self
99
100 def __exit__(self, exc_type, exc_value, traceback):
101 self.elapsed_time = time.time() - self.start_time
102 # 转换成小时
103 self.eta = round((self.rest_epochs * self.elapsed_time) / 3600, 2)
104
105
106

Callers 15

trainMethod · 0.90
trainMethod · 0.90
update_actor_dpoMethod · 0.85
_timerFunction · 0.85
fit_dpoMethod · 0.85
test_data_transferFunction · 0.85
_timerFunction · 0.85
update_actorMethod · 0.85
update_criticMethod · 0.85
update_actorMethod · 0.85
update_criticMethod · 0.85
update_actor_dpoMethod · 0.85

Calls

no outgoing calls

Tested by 2

test_data_transferFunction · 0.68
test_data_transferFunction · 0.68