提交 3c089d9e authored 作者: Frederic Bastien's avatar Frederic Bastien

print each theano fct profile separatly even if they have the same name or no name.

上级 842cc29e
...@@ -510,8 +510,8 @@ class Function(object): ...@@ -510,8 +510,8 @@ class Function(object):
dt_call=time.time()-t0 dt_call=time.time()-t0
if hasattr(self.maker.mode,'fct_call_time'): if hasattr(self.maker.mode,'fct_call_time'):
self.maker.mode.fct_call_time[self.name] += dt_call self.maker.mode.fct_call_time[self] += dt_call
self.maker.mode.fct_call[self.name] += 1 self.maker.mode.fct_call[self] += 1
self.maker.mode.call_time += dt_call self.maker.mode.call_time += dt_call
self.maker.mode.fn_time += dt_fn self.maker.mode.fn_time += dt_fn
...@@ -952,9 +952,9 @@ def orig_function(inputs, outputs, mode=None, accept_inplace = False, name=None) ...@@ -952,9 +952,9 @@ def orig_function(inputs, outputs, mode=None, accept_inplace = False, name=None)
fn.name = name fn.name = name
if hasattr(mode,'fct_call_time'): if hasattr(mode,'fct_call_time'):
mode.fct_call_time.setdefault(name,0) mode.fct_call_time.setdefault(fn,0)
if hasattr(mode,'fct_call'): if hasattr(mode,'fct_call'):
mode.fct_call.setdefault(name,0) mode.fct_call.setdefault(fn,0)
return fn return fn
......
...@@ -296,8 +296,11 @@ class ProfileMode(Mode): ...@@ -296,8 +296,11 @@ class ProfileMode(Mode):
print print
print 'Theano fct summary: <% total fct time> <total time> <time per call> <nb call> <fct name>' print 'Theano fct summary: <% total fct time> <total time> <time per call> <nb call> <fct name>'
for key in fct_call.keys(): for key in fct_call.keys():
if fct_call[key]>0:
print ' %4.1f%% %.3fs %.2es %d %s'%(fct_call_time[key]/total_fct_time*100 ,fct_call_time[key], print ' %4.1f%% %.3fs %.2es %d %s'%(fct_call_time[key]/total_fct_time*100 ,fct_call_time[key],
fct_call_time[key]/fct_call[key], fct_call[key],key) fct_call_time[key]/fct_call[key], fct_call[key], key.name)
else:
print ' NOT CALLED',key.name
print print
print 'Time since import %.3fs'%(total_time) print 'Time since import %.3fs'%(total_time)
print 'Compile time: %.3fs %.1f%%'%(compile_time, compile_time/total_time*100) print 'Compile time: %.3fs %.1f%%'%(compile_time, compile_time/total_time*100)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论