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

Function middle

projects/mmdet3d_plugin/models/utils/bricks.py:8–18  ·  view source on GitHub ↗
(fn)

Source from the content-addressed store, hash-verified

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