MCPcopy Create free account
hub / github.com/OpenDriveLab/OccNet / run_time

Function run_time

projects/mmdet3d_plugin/models/utils/bricks.py:7–19  ·  view source on GitHub ↗
(name)

Source from the content-addressed store, hash-verified

5time_maps = defaultdict(lambda :0.)
6count_maps = defaultdict(lambda :0.)
7def run_time(name):
8 def middle(fn):
9 def wrapper(*args, **kwargs):
10 torch.cuda.synchronize()
11 start = time.time()
12 res = fn(*args, **kwargs)
13 torch.cuda.synchronize()
14 time_maps['%s : %s'%(name, fn.__name__) ] += time.time()-start
15 count_maps['%s : %s'%(name, fn.__name__) ] +=1
16 print("%s : %s takes up %f "% (name, fn.__name__,time_maps['%s : %s'%(name, fn.__name__) ] /count_maps['%s : %s'%(name, fn.__name__) ] ))
17 return res
18 return wrapper
19 return middle
20

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected