提交 2db0017d authored 作者: Ian Goodfellow's avatar Ian Goodfellow

fixed memory aliasing in destroyhandler (probably didn't cause bug

because we probably never used the aliased objects)
上级 70c22e0d
...@@ -644,27 +644,28 @@ class DestroyHandler(toolbox.Bookkeeper): ...@@ -644,27 +644,28 @@ class DestroyHandler(toolbox.Bookkeeper):
<unknown> <unknown>
""" """
def __init__(self, do_imports_on_attach=True):
self.fgraph = None
self.do_imports_on_attach = do_imports_on_attach
"""maps every variable in the graph to its "foundation" (deepest """maps every variable in the graph to its "foundation" (deepest
ancestor in view chain) ancestor in view chain)
TODO: change name to var_to_vroot""" TODO: change name to var_to_vroot"""
droot = {} self.droot = OrderedDict()
"""maps a variable to all variables that are indirect or direct views of it """maps a variable to all variables that are indirect or direct views of it
(including itself) (including itself)
essentially the inverse of droot essentially the inverse of droot
TODO: do all variables appear in this dict, or only those that are foundations? TODO: do all variables appear in this dict, or only those that are foundations?
TODO: do only destoryed variables go in here? one old docstring said so TODO: do only destroyed variables go in here? one old docstring said so
TODO: rename to x_to_views after reverse engineering what x is""" TODO: rename to x_to_views after reverse engineering what x is"""
impact = {} self.impact = OrderedDict()
"""if a var is destroyed, then this dict will map """if a var is destroyed, then this dict will map
droot[var] to the apply node that destroyed var droot[var] to the apply node that destroyed var
TODO: rename to vroot_to_destroyer""" TODO: rename to vroot_to_destroyer"""
root_destroyer = {} self.root_destroyer = OrderedDict()
def __init__(self, do_imports_on_attach=True):
self.fgraph = None
self.do_imports_on_attach = do_imports_on_attach
def on_attach(self, fgraph): def on_attach(self, fgraph):
""" """
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论