提交 7d4616b9 authored 作者: Mohammad Pezeshki's avatar Mohammad Pezeshki

computing total time for children tree is now more efficient

上级 74ee0d01
......@@ -294,17 +294,20 @@ class ProfileStats(object):
rval[node.op] += t
return rval
def get_node_total_time(self, node):
def get_node_total_time(self, node, total_times):
if node not in total_times.keys():
total = self.apply_time[node]
for parent in node.get_parents():
if parent.owner in self.apply_time.keys():
total += self.get_node_total_time(parent.owner)
return total
else:
return total_times[node]
def compute_total_times(self):
rval = {}
for node in self.apply_time.keys():
rval[node] = self.get_node_total_time(node)
rval[node] = self.get_node_total_time(node, rval)
return rval
def op_callcount(self):
......
......@@ -115,21 +115,20 @@ def debugprint(obj, depth=-1, print_type=False,
obj)
scan_ops = []
for r in results_to_print:
for r, p in zip(results_to_print, profile_list):
# Add the parent scan op to the list as well
if (hasattr(r.owner, 'op') and
isinstance(r.owner.op, theano.scan_module.scan_op.Scan)):
scan_ops.append(r)
profile = obj.profile
if profile != None:
if p != None:
print 'Timing Info\n-----------\n\t \
--> <time> <% time> - <total time> <% total time>'
debugmode.debugprint(r, depth=depth, done=done, print_type=print_type,
file=_file, order=order, ids=ids,
scan_ops=scan_ops, stop_on_name=stop_on_name,
profile=profile)
profile=p)
if len(scan_ops) > 0:
print >> file, ""
new_prefix = ' >'
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论