提交 248919d0 authored 作者: fsavard's avatar fsavard

Added printing of output names for apply nodes in debugprint, such that if you…

Added printing of output names for apply nodes in debugprint, such that if you manually assign a name to the outputs (variables), the name will be printed in the debugprint output.
上级 1f5d3630
...@@ -408,10 +408,19 @@ def debugprint(r, prefix='', depth=-1, done=None, print_type=False, file=sys.std ...@@ -408,10 +408,19 @@ def debugprint(r, prefix='', depth=-1, done=None, print_type=False, file=sys.std
# this variable is the output of computation, # this variable is the output of computation,
# so just print out the apply # so just print out the apply
a = r.owner a = r.owner
r_name = getattr(r, 'name', '')
# normally if the name isn't set, it'll be None, so
# r_name == None here
if r_name is None:
r_name = ''
if len(a.outputs) == 1: if len(a.outputs) == 1:
print >> file, '%s%s [@%i]%s' % (prefix, a.op, id(r), type_str) print >> file, '%s%s [@%i]%s \'%s\'' % (prefix, a.op, id(r), \
type_str, r_name)
else: else:
print >> file, '%s%s.%i [@%i]%s' % (prefix, a.op, a.outputs.index(r), id(r), type_str) print >> file, '%s%s.%i [@%i]%s \'%s\'' % (prefix, a.op, \
a.outputs.index(r), id(r), type_str, r_name)
if id(a) not in done: if id(a) not in done:
done.add(id(a)) done.add(id(a))
for i in a.inputs: for i in a.inputs:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论