提交 ec4937f3 authored 作者: Frederic Bastien's avatar Frederic Bastien

fix gh-5753

上级 7a6427cf
...@@ -876,10 +876,13 @@ class Validator(object): ...@@ -876,10 +876,13 @@ class Validator(object):
if out.owner is None: if out.owner is None:
if isinstance(out, tensor.TensorConstant): if isinstance(out, tensor.TensorConstant):
if hasattr(out, 'fgraph'): if hasattr(out, 'fgraph') or getattr(out, 'cached', False):
# If out have an fgraph, we aren't sure if it # If out have an fgraph, we aren't sure if it
# is from the inner graph or outer graph, so # is from the inner graph or outer graph, so
# clone it. # clone it.
# As it will be used as is in an FunctionGraph
# (won't be cloned later), it can't be a
# cached variable
cloned_out = out.clone() cloned_out = out.clone()
self.valid.add(cloned_out) self.valid.add(cloned_out)
self.invalid.add(out) self.invalid.add(out)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论