提交 27270d63 authored 作者: Olivier Breuleux's avatar Olivier Breuleux

small fix for hashing failure

上级 6347cfc5
...@@ -810,6 +810,7 @@ class OpWiseCLinker(link.LocalLinker): ...@@ -810,6 +810,7 @@ class OpWiseCLinker(link.LocalLinker):
try: try:
e = Env(*graph.clone(node.inputs, node.outputs)) e = Env(*graph.clone(node.inputs, node.outputs))
e.toposort = lambda: e.nodes e.toposort = lambda: e.nodes
if any(isinstance(input, graph.Value) for input in node.inputs): if any(isinstance(input, graph.Value) for input in node.inputs):
desc = None desc = None
else: else:
...@@ -817,12 +818,19 @@ class OpWiseCLinker(link.LocalLinker): ...@@ -817,12 +818,19 @@ class OpWiseCLinker(link.LocalLinker):
tuple(input.type for input in node.inputs), tuple(input.type for input in node.inputs),
tuple(input.type for input in node.inputs), tuple(input.type for input in node.inputs),
tuple(output in no_recycling for output in node.outputs)) tuple(output in no_recycling for output in node.outputs))
if desc in self.__cache__:
cl = self.__cache__[desc] try:
else: cl = self.__cache__.get(desc)
except:
print "harmless warning: failed to hash %s" % node
cl = None
if cl is None:
cl = CLinker().accept(e, [r for r, r2 in zip(e.outputs, node.outputs) if r2 in no_recycling]) cl = CLinker().accept(e, [r for r, r2 in zip(e.outputs, node.outputs) if r2 in no_recycling])
if desc is not None: if desc is not None:
try:
self.__cache__[desc] = cl self.__cache__[desc] = cl
except:
pass
thunk, node_input_filters, node_output_filters = cl.make_thunk( thunk, node_input_filters, node_output_filters = cl.make_thunk(
input_storage = node_input_storage, input_storage = node_input_storage,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论