提交 19bc8600 authored 作者: rizar's avatar rizar

Fix dependency on random order of dict.keys()

上级 ddd11bd4
...@@ -418,13 +418,12 @@ class Variable(Node): ...@@ -418,13 +418,12 @@ class Variable(Node):
if not hasattr(self, '_fn_cache'): if not hasattr(self, '_fn_cache'):
self._fn_cache = dict() self._fn_cache = dict()
input_list = list(inputs_to_values.keys()) inputs = tuple(sorted(inputs_to_values.keys(), key=id))
input_set = frozenset(input_list) if not inputs in self._fn_cache:
if not input_set in self._fn_cache: self._fn_cache[inputs] = theano.function(inputs, self)
self._fn_cache[input_set] = theano.function(input_list, self) args = [inputs_to_values[param] for param in inputs]
args = [inputs_to_values[param] for param in input_list]
rval = self._fn_cache[input_set](*args) rval = self._fn_cache[inputs](*args)
return rval return rval
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论