提交 8d790f5c authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Merge pull request #1641 from nouiz/time_opt2

code cleanup
......@@ -1022,8 +1022,6 @@ class FunctionMaker(object):
optimizer_profile = optimizer(fgraph)
end_optimizer = time.time()
opt_time = end_optimizer - start_optimizer
mode.optimizer_time += opt_time
if profile:
profile.optimizer_time += opt_time
if theano.config.profile_optimizer:
......@@ -1183,7 +1181,6 @@ class FunctionMaker(object):
linker_time = end_linker - start_linker
_logger.debug('Linker took %f seconds', linker_time)
self.mode.linker_time += linker_time
if self.profile:
self.profile.linker_time += linker_time
_fn.time_thunks = self.profile.flag_time_thunks
......
......@@ -262,8 +262,6 @@ class Mode(object):
self.call_time = 0
self.fn_time = 0
linker.mode = self # TODO: WHY IS THIS HERE?
self.optimizer_time = 0
self.linker_time = 0
def __str__(self):
return "%s(linker = %s, optimizer = %s)" % (self.__class__.__name__,
......
......@@ -202,8 +202,6 @@ class ProfileMode(Mode):
self.call_time = 0
self.fn_time = 0
self.optimizer_time = 0
self.linker_time = 0
def print_summary(self, **kwargs):
""" Print 3 summary that show where the time is spend. The first show an Apply-wise summary, the second show an Op-wise summary, the third show an type-Op-wise summary.
......@@ -289,9 +287,18 @@ class ProfileMode(Mode):
apply_cimpl = self.apply_cimpl and other.apply_cimpl
message = self.message
variable_shape = diff_dict(self.variable_shape, other.variable_shape)
other_time = {'linker_time': self.linker_time - other.linker_time,
'optimizer_time': self.optimizer_time -
other.optimizer_time}
self_linker_time = sum([ps.linker_time for ps
in self.profile_stats.values()])
other_linker_time = sum([ps.linker_time for ps
in other.profile_stats.values()])
self_optimizer_time = sum([ps.optimizer_time for ps
in self.profile_stats.values()])
other_optimizer_time = sum([ps.optimizer_time for ps
in other.profile_stats.values()])
other_time = {'linker_time': self_linker_time - other_linker_time,
'optimizer_time': self_optimizer_time -
other_optimizer_time}
self.print_summary_("print_diff_summary", compile_time,
fct_call_time, fct_call,
apply_time, apply_cimpl, message, variable_shape,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论