MCPcopy Index your code
hub / github.com/tensorpack/tensorpack / log

Method log

tensorpack/callbacks/group.py:33–44  ·  view source on GitHub ↗

log the time of some heavy callbacks

(self)

Source from the content-addressed store, hash-verified

31 self.add(name, timer() - s)
32
33 def log(self):
34
35 """ log the time of some heavy callbacks """
36 if self.tot < 2:
37 return
38 msgs = []
39 for name, t in self.times:
40 if t / self.tot > 0.3 and t > 1:
41 msgs.append(name + ": " + humanize_time_delta(t))
42 logger.info(
43 "Callbacks took {:.3f} sec in total. {}".format(
44 self.tot, '; '.join(msgs)))
45
46
47class Callbacks(Callback):

Callers 1

_trigger_epochMethod · 0.95

Calls 4

humanize_time_deltaFunction · 0.85
appendMethod · 0.80
formatMethod · 0.80
joinMethod · 0.80

Tested by

no test coverage detected