提交 0e9af9c4 authored 作者: Frederic Bastien's avatar Frederic Bastien

now record the theano fct call time and fn call time in all Mode, but don't print them.

Usefull to track the overhead of theano fct call.
上级 7a95162c
......@@ -448,7 +448,9 @@ class Function(object):
self.inv_finder[c]))
# Do the actual work
t0_fn = time.time()
self.fn()
dt_fn = time.time() - t0_fn
# Retrieve the values that were computed
outputs = [x.data for x in self.output_storage]
......@@ -486,6 +488,9 @@ class Function(object):
self.maker.mode.fct_call_time[self.name] += dt_call
self.maker.mode.fct_call[self.name] += 1
self.maker.mode.call_time += dt_call
self.maker.mode.fn_time += dt_fn
if self.return_none:
return None
elif self.unpack_single and len(outputs) == 1:
......
......@@ -172,6 +172,8 @@ class Mode(object):
if isinstance(optimizer, gof.Query):
self.provided_optimizer = optimizer
self._optimizer = optimizer
self.call_time = 0
self.fn_time = 0
def __str__(self):
return "Mode(linker = %s, optimizer = %s)" % (self.provided_linker, self.provided_optimizer)
......
......@@ -74,6 +74,8 @@ class ProfileMode(Mode):
self.compile_time = compile_time
self.fct_call_time = fct_call_time
self.fct_call = fct_call
self.call_time = 0
self.fn_time = 0
def blah(i, node, th):
if hasattr(th, 'cthunk'):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论