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

Update following code review

上级 513b04ab
...@@ -620,7 +620,8 @@ def debugprint(r, prefix='', depth=-1, done=None, print_type=False, ...@@ -620,7 +620,8 @@ def debugprint(r, prefix='', depth=-1, done=None, print_type=False,
scan_inner_to_outer_inputs scan_inner_to_outer_inputs
A dictionary mapping a scan ops inner function inputs to the scan op A dictionary mapping a scan ops inner function inputs to the scan op
inputs (outer inputs) for printing purposes. inputs (outer inputs) for printing purposes.
smap
None or the storage_map when printing an Theano function.
""" """
if depth == 0: if depth == 0:
return return
...@@ -689,14 +690,14 @@ def debugprint(r, prefix='', depth=-1, done=None, print_type=False, ...@@ -689,14 +690,14 @@ def debugprint(r, prefix='', depth=-1, done=None, print_type=False,
already_printed = a in done # get_id_str put it in the dict already_printed = a in done # get_id_str put it in the dict
id_str = get_id_str(a) id_str = get_id_str(a)
if len(a.outputs) == 1:
idx = ""
else:
idx = ".%i" % a.outputs.index(r)
data = ""
if smap:
data = " " + str(smap.get(a.outputs[0], ''))
if profile is None or a not in profile.apply_time: if profile is None or a not in profile.apply_time:
if len(a.outputs) == 1:
idx = ""
else:
idx = ".%i" % a.outputs.index(r)
data = ""
if smap:
data = " " + str(smap[a.outputs[0]])
print('%s%s%s %s%s \'%s\' %s %s %s%s' % (prefix, a.op, print('%s%s%s %s%s \'%s\' %s %s %s%s' % (prefix, a.op,
idx, idx,
id_str, type_str, id_str, type_str,
...@@ -715,7 +716,7 @@ def debugprint(r, prefix='', depth=-1, done=None, print_type=False, ...@@ -715,7 +716,7 @@ def debugprint(r, prefix='', depth=-1, done=None, print_type=False,
idx = "" idx = ""
else: else:
idx = ".%i" % a.outputs.index(r) idx = ".%i" % a.outputs.index(r)
print("%s%s%s %s%s '%s' %s %s %s --> " print("%s%s%s %s%s '%s' %s %s %s%s --> "
"%8.2es %4.1f%% %8.2es %4.1f%%" "%8.2es %4.1f%% %8.2es %4.1f%%"
% (prefix, a.op, % (prefix, a.op,
idx, idx,
...@@ -723,7 +724,8 @@ def debugprint(r, prefix='', depth=-1, done=None, print_type=False, ...@@ -723,7 +724,8 @@ def debugprint(r, prefix='', depth=-1, done=None, print_type=False,
r_name, r_name,
destroy_map_str, destroy_map_str,
view_map_str, view_map_str,
o, op_time, o, data,
op_time,
op_time_percent, op_time_percent,
tot_time, tot_time,
tot_time_percent), file=file) tot_time_percent), file=file)
...@@ -768,7 +770,7 @@ def debugprint(r, prefix='', depth=-1, done=None, print_type=False, ...@@ -768,7 +770,7 @@ def debugprint(r, prefix='', depth=-1, done=None, print_type=False,
# this is an input variable # this is an input variable
data = "" data = ""
if smap: if smap:
data = " " + str(smap[r]) data = " " + str(smap.get(r, ''))
id_str = get_id_str(r) id_str = get_id_str(r)
print('%s%s %s%s%s' % (prefix, r, id_str, print('%s%s %s%s%s' % (prefix, r, id_str,
type_str, data), type_str, data),
......
...@@ -2664,9 +2664,9 @@ class Alloc(gof.Op): ...@@ -2664,9 +2664,9 @@ class Alloc(gof.Op):
(i, s_as_str)) (i, s_as_str))
if s.ndim != 0: if s.ndim != 0:
raise TypeError( raise TypeError(
'Each shape dimensions to Alloc must be scalars, ' "Each shape dimension to Alloc must be a scalar, ",
'but dimensions %s is not for apply node: %s' % 'but dimension %s is not for apply node: %s' %
(i, s_as_str)) (i, s_as_str, s.ndim))
# if s is constant 1, then we're broadcastable in that dim # if s is constant 1, then we're broadcastable in that dim
try: try:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论