提交 b29ba73d authored 作者: carriepl's avatar carriepl

Don't consider unknown inputs to be invalid by default

上级 146fbae8
...@@ -857,16 +857,19 @@ class Validator(object): ...@@ -857,16 +857,19 @@ class Validator(object):
return None return None
if out.owner is None: if out.owner is None:
# This is an unknown input node, so it is invalid.
self.invalid.add(out)
if isinstance(out, tensor.TensorConstant): if isinstance(out, tensor.TensorConstant):
# We can clone it to get a valid constant # This might be a constant from the outer graph or a constant
# from the inner graph. In all cases, we can clone it to be
# certain we have a valid constant
cloned_out = out.clone() cloned_out = out.clone()
self.valid.add(cloned_out) self.valid.add(cloned_out)
self.invalid.add(out)
self.valid_equivalent[out] = cloned_out self.valid_equivalent[out] = cloned_out
return cloned_out, False return cloned_out, False
else:
return None # This is an input node and it has not been explicitly marked
# as invalid so we can use it
return out, True
# Recurse over inputs # Recurse over inputs
inputs = [self.check(i) for i in out.owner.inputs] inputs = [self.check(i) for i in out.owner.inputs]
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论