提交 0e4b2ea8 authored 作者: Reyhane Askari's avatar Reyhane Askari

minor fix and fix for py3

上级 65049062
...@@ -811,17 +811,17 @@ class DestroyHandler(toolbox.Bookkeeper): # noqa ...@@ -811,17 +811,17 @@ class DestroyHandler(toolbox.Bookkeeper): # noqa
app2 = inp.owner app2 = inp.owner
inp_idx2 = app2.outputs.index(inp) inp_idx2 = app2.outputs.index(inp)
v = getattr(app2.op, 'view_map', {}) v = getattr(app2.op, 'view_map', {})
d = getattr(app2.op, 'destroy_map', {})
if v: if v:
v = v.get(inp_idx2, []) v = v.get(inp_idx2, [])
if len(v) > 0: if len(v) > 0:
self.fail_validate[app] = theano.gof.InconsistencyError( self.fail_validate[app] = theano.gof.InconsistencyError(
"Destroyed variable has view_map. " + str(reason)) "Destroyed variable has view_map. " + str(reason))
d = getattr(app2.op, 'destroy_map', {}) elif d:
if d:
d = d.get(inp_idx2, []) d = d.get(inp_idx2, [])
if len(d) > 0: if len(d) > 0:
self.fail_validate[app] = theano.gof.InconsistencyError( self.fail_validate[app] = theano.gof.InconsistencyError(
"Destroyed variable has destroy_map. " + str(reason)) "Destroyed variable has destroy_map. " + str(reason))
assert len(v) <= 1 assert len(v) <= 1
assert len(d) <= 1 assert len(d) <= 1
...@@ -977,8 +977,7 @@ class DestroyHandler(toolbox.Bookkeeper): # noqa ...@@ -977,8 +977,7 @@ class DestroyHandler(toolbox.Bookkeeper): # noqa
self.fast_destroy(app, 'validate') self.fast_destroy(app, 'validate')
if self.fail_validate: if self.fail_validate:
self.fail_validate = app_err_pairs self.fail_validate = app_err_pairs
err = app_err_pairs.values()[0] raise app_err_pairs[app]
raise err
else: else:
ords = self.orderings(fgraph) ords = self.orderings(fgraph)
if _contains_cycle(fgraph, ords): if _contains_cycle(fgraph, ords):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论