MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / get_avg_time

Function get_avg_time

imperative/python/megengine/tools/benchmark_op.py:417–426  ·  view source on GitHub ↗
(func, inps, reps, unpack_inps, is_mge)

Source from the content-addressed store, hash-verified

415
416
417def get_avg_time(func, inps, reps, unpack_inps, is_mge):
418 # warm up
419 for _ in range(2):
420 t = perf_func(func, inps, reps, unpack_inps, is_mge)
421
422 times = []
423 for _ in range(5):
424 t = perf_func(func, inps, reps, unpack_inps, is_mge)
425 times.append(t)
426 return np.mean(times)
427
428
429def get_perf_results(mge_func, torch_func, shapes, unpack_inps, reps):

Callers 1

get_perf_resultsFunction · 0.85

Calls 3

perf_funcFunction · 0.85
appendMethod · 0.45
meanMethod · 0.45

Tested by

no test coverage detected