提交 ab80029a authored 作者: Olivier Breuleux's avatar Olivier Breuleux

fixes #171 (closure bug)

上级 6d1813d9
...@@ -165,7 +165,7 @@ class Value(Result): ...@@ -165,7 +165,7 @@ class Value(Result):
return self.name return self.name
return "<" + str(self.data) + ">" #+ "::" + str(self.type) return "<" + str(self.data) + ">" #+ "::" + str(self.type)
def clone(self): def clone(self):
return self.__class__(self.type, self.data, self.name) return self.__class__(self.type, copy(self.data), self.name)
def __set_owner(self, value): def __set_owner(self, value):
if value is not None: if value is not None:
raise ValueError("Value instances cannot have an owner.") raise ValueError("Value instances cannot have an owner.")
......
...@@ -33,7 +33,7 @@ class Optimizer: ...@@ -33,7 +33,7 @@ class Optimizer:
def optimize(self, env, *args, **kwargs): def optimize(self, env, *args, **kwargs):
""" """
This is meant as a shortcut to:: This is meant as a shortcut to::
env.satisfy(opt) opt.add_requirements(env)
opt.apply(env) opt.apply(env)
""" """
self.add_requirements(env) self.add_requirements(env)
......
...@@ -101,6 +101,8 @@ def grad_sources_inputs(sources, graph_inputs): ...@@ -101,6 +101,8 @@ def grad_sources_inputs(sources, graph_inputs):
len(g_inputs), len(g_inputs),
len(node.inputs)) len(node.inputs))
for r, g_r in zip(node.inputs, g_inputs): for r, g_r in zip(node.inputs, g_inputs):
if g_r and len(sources) == 1 and sources[0][0].name and r.name:
g_r.name = "(d%s/d%s)" % (sources[0][0].name, r.name)
if g_r is not None: if g_r is not None:
if r in gmap: if r in gmap:
gmap[r] = gmap[r] + g_r gmap[r] = gmap[r] + g_r
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论