提交 dcbc95aa authored 作者: Frederic Bastien's avatar Frederic Bastien

Fix profiling info in case of lazy operation

上级 75cd8839
...@@ -1559,6 +1559,7 @@ def orig_function(inputs, outputs, mode=None, accept_inplace=False, ...@@ -1559,6 +1559,7 @@ def orig_function(inputs, outputs, mode=None, accept_inplace=False,
t2 = time.time() t2 = time.time()
if profile: if profile:
profile.compile_time += t2 - t1 profile.compile_time += t2 - t1
profile.nb_nodes = len(fn.maker.fgraph.nodes)
fn.name = name fn.name = name
fn.maker.fgraph.name = name fn.maker.fgraph.name = name
......
...@@ -199,6 +199,11 @@ class ProfileStats(object): ...@@ -199,6 +199,11 @@ class ProfileStats(object):
line_width = config.profiling.output_line_width line_width = config.profiling.output_line_width
nb_nodes = -1
# The number of nodes in the graph. We need the infomartion
# separatly in case we print the profile when the function wasn't
# executed or if there is lazy operation in the graph.
optimizer_profile = None optimizer_profile = None
# None or tuple (the optimizer, the profile it returned) # None or tuple (the optimizer, the profile it returned)
...@@ -637,7 +642,7 @@ class ProfileStats(object): ...@@ -637,7 +642,7 @@ class ProfileStats(object):
print >> file, ' Time in thunks: %es (%.3f%%)' % ( print >> file, ' Time in thunks: %es (%.3f%%)' % (
local_time, 100 * local_time / self.fct_call_time) local_time, 100 * local_time / self.fct_call_time)
print >> file, ' Total compile time: %es' % self.compile_time print >> file, ' Total compile time: %es' % self.compile_time
print >> file, ' Number of Apply nodes: %s' % len(self.apply_time) print >> file, ' Number of Apply nodes: %d' % self.nb_nodes
print >> file, ' Theano Optimizer time: %es' % self.optimizer_time print >> file, ' Theano Optimizer time: %es' % self.optimizer_time
print >> file, ' Theano validate time: %es' % self.validate_time print >> file, ' Theano validate time: %es' % self.validate_time
print >> file, (' Theano Linker time (includes C,' print >> file, (' Theano Linker time (includes C,'
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论