提交 e7cb39cb authored 作者: Frederic's avatar Frederic

pep8

上级 76d02f64
...@@ -107,8 +107,9 @@ def debugprint(obj, depth=-1, print_type=False, ...@@ -107,8 +107,9 @@ def debugprint(obj, depth=-1, print_type=False,
scan_ops = [] scan_ops = []
for r in results_to_print: for r in results_to_print:
#Add the parent scan op to the list as well # 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): if (hasattr(r.owner, 'op') and
isinstance(r.owner.op, theano.scan_module.scan_op.Scan)):
scan_ops.append(r) scan_ops.append(r)
debugmode.debugprint(r, depth=depth, done=done, print_type=print_type, debugmode.debugprint(r, depth=depth, done=done, print_type=print_type,
...@@ -122,7 +123,8 @@ def debugprint(obj, depth=-1, print_type=False, ...@@ -122,7 +123,8 @@ def debugprint(obj, depth=-1, print_type=False,
for s in scan_ops: for s in scan_ops:
print >> file, "" print >> file, ""
debugmode.debugprint(s, depth=depth, done=done, print_type=print_type, debugmode.debugprint(s, depth=depth, done=done,
print_type=print_type,
file=_file, ids=ids, file=_file, ids=ids,
scan_ops=scan_ops, stop_on_name=stop_on_name) scan_ops=scan_ops, stop_on_name=stop_on_name)
if hasattr(s.owner.op, 'fn'): if hasattr(s.owner.op, 'fn'):
...@@ -135,10 +137,12 @@ def debugprint(obj, depth=-1, print_type=False, ...@@ -135,10 +137,12 @@ def debugprint(obj, depth=-1, print_type=False,
if isinstance(i.owner.op, theano.scan_module.scan_op.Scan): if isinstance(i.owner.op, theano.scan_module.scan_op.Scan):
scan_ops.append(i) scan_ops.append(i)
debugmode.debugprint(r=i, prefix=new_prefix, depth=depth, done=done, debugmode.debugprint(r=i, prefix=new_prefix,
depth=depth, done=done,
print_type=print_type, file=file, print_type=print_type, file=file,
ids=ids, stop_on_name=stop_on_name, ids=ids, stop_on_name=stop_on_name,
prefix_child=new_prefix_child, scan_ops=scan_ops) prefix_child=new_prefix_child,
scan_ops=scan_ops)
if file is _file: if file is _file:
return file return file
...@@ -696,8 +700,8 @@ def pydotprint(fct, outfile=None, ...@@ -696,8 +700,8 @@ def pydotprint(fct, outfile=None,
varstr = (input_update[var].variable.name + " UPDATE " varstr = (input_update[var].variable.name + " UPDATE "
+ str(var.type)) + str(var.type))
else: else:
#a var id is needed as otherwise var with the same type will be # a var id is needed as otherwise var with the same type will be
#merged in the graph. # merged in the graph.
varstr = str(var.type) varstr = str(var.type)
if (varstr in all_strings) or with_ids: if (varstr in all_strings) or with_ids:
idx = ' id=' + str(len(var_str)) idx = ' id=' + str(len(var_str))
...@@ -726,7 +730,7 @@ def pydotprint(fct, outfile=None, ...@@ -726,7 +730,7 @@ def pydotprint(fct, outfile=None,
prof_str = '' prof_str = ''
if mode: if mode:
time = mode.profile_stats[fct].apply_time.get(node, 0) time = mode.profile_stats[fct].apply_time.get(node, 0)
#second, % total time in profiler, %fct time in profiler # second, % total time in profiler, %fct time in profiler
if mode.local_time == 0: if mode.local_time == 0:
pt = 0 pt = 0
else: else:
...@@ -738,7 +742,7 @@ def pydotprint(fct, outfile=None, ...@@ -738,7 +742,7 @@ def pydotprint(fct, outfile=None,
prof_str = ' (%.3fs,%.3f%%,%.3f%%)' % (time, pt, pf) prof_str = ' (%.3fs,%.3f%%,%.3f%%)' % (time, pt, pf)
elif profile: elif profile:
time = profile.apply_time.get(node, 0) time = profile.apply_time.get(node, 0)
#second, %fct time in profiler # second, %fct time in profiler
if profile.fct_callcount == 0: if profile.fct_callcount == 0:
pf = 0 pf = 0
else: else:
...@@ -819,7 +823,7 @@ def pydotprint(fct, outfile=None, ...@@ -819,7 +823,7 @@ def pydotprint(fct, outfile=None,
elif var.name or not compact: elif var.name or not compact:
g.add_edge(pd.Edge(varstr, astr, label=label)) g.add_edge(pd.Edge(varstr, astr, label=label))
else: else:
#no name, so we don't make a var ellipse # no name, so we don't make a var ellipse
g.add_edge(pd.Edge(apply_name(var.owner), astr, label=label)) g.add_edge(pd.Edge(apply_name(var.owner), astr, label=label))
for id, var in enumerate(node.outputs): for id, var in enumerate(node.outputs):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论