(fn)
| 6 | count_maps = defaultdict(lambda :0.) |
| 7 | def 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 |
nothing calls this directly
no outgoing calls
no test coverage detected