提交 d7c2cfcc authored 作者: James Bergstra's avatar James Bergstra

debugmode linker cleans up storage_map better after exception

上级 e24eb744
...@@ -836,6 +836,8 @@ class _Linker(gof.link.LocalLinker): ...@@ -836,6 +836,8 @@ class _Linker(gof.link.LocalLinker):
# Precondition: the storage map is empty, transferred completely to r_vals # Precondition: the storage map is empty, transferred completely to r_vals
##### #####
for r, s in storage_map.iteritems(): for r, s in storage_map.iteritems():
if s[0] is not None:
print r, s
assert s[0] is None assert s[0] is None
#try: #try:
...@@ -952,9 +954,12 @@ class _Linker(gof.link.LocalLinker): ...@@ -952,9 +954,12 @@ class _Linker(gof.link.LocalLinker):
else: else:
storage_map[r][0] = dr_vals[r][0] storage_map[r][0] = dr_vals[r][0]
except: except:
for r in original_storage_map_keys: for r in storage_map:
if r in original_storage_map_keys:
if storage_map[r][0] is None: if storage_map[r][0] is None:
storage_map[r][0] = r_vals[r] storage_map[r][0] = r_vals[r]
else:
storage_map[r][0] = None # clear out any partially-computed stuff
raise raise
#print "" #print ""
#print output_storage #print output_storage
......
...@@ -589,5 +589,8 @@ class Test_check_isfinite(unittest.TestCase): ...@@ -589,5 +589,8 @@ class Test_check_isfinite(unittest.TestCase):
pass pass
#inf should go through #inf should go through
f(numpy.asarray([1.0, 1.0, 1.0])/0) infs = numpy.asarray([1.0,1.,1.])/0
print infs
f(infs)
return
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论