MCPcopy Create free account
hub / github.com/LynnHo/EigenGAN-Tensorflow / wrapper

Function wrapper

scripts/pylib/timer.py:82–90  ·  view source on GitHub ↗
(*args, **kwargs)

Source from the content-addressed store, hash-verified

80
81 def decorator(f):
82 def wrapper(*args, **kwargs):
83 timer_kwargs.update(print_at_exit=False)
84 with Timer(**timer_kwargs) as t:
85 for _ in range(run_times):
86 out = f(*args, **kwargs)
87 fmt = '[*] Execution time of function "%(function_name)s" for %(run_times)d runs is %(execution_time)s = %(execution_time_each)s * %(run_times)d [*]'
88 context = {'function_name': f.__name__, 'run_times': run_times, 'execution_time': t, 'execution_time_each': t.fmt(t.elapsed / run_times)[1]}
89 print(fmt % context)
90 return out
91 return wrapper
92
93 return decorator

Callers

nothing calls this directly

Calls 2

TimerClass · 0.70
fmtMethod · 0.45

Tested by

no test coverage detected