提交 7d364ea2 authored 作者: Frederic's avatar Frederic

Fix scan unpickle (crash) as we added a new attribute. Also make a scan opt…

Fix scan unpickle (crash) as we added a new attribute. Also make a scan opt support old pickled Subtensor.
上级 5895d5a2
......@@ -170,6 +170,12 @@ class Scan(PureOp):
self._cmodule_key = gof.CLinker().cmodule_key_(local_fgraph, [])
self._hash_inner_graph = hash(self._cmodule_key)
def __setstate__(self, d):
self.__dict__.update(d)
if "allow_gc" not in self.__dict__:
self.allow_gc = True
self.info['allow_gc'] = True
def make_node(self, *inputs):
"""
Conventions:
......
......@@ -798,12 +798,12 @@ class PushOutScanOutput(gof.Optimizer):
client = outer_var.clients[0][0]
if (client != 'output' and
isinstance(client.op, theano.tensor.Subtensor) and
isinstance(client.inputs[1], theano.Constant) and
client.inputs[1].ndim == 0 and
client.inputs[1].value == -1):
return True
isinstance(client.op, theano.tensor.Subtensor)):
lst = theano.tensor.subtensor.get_idx_list(
client.inputs, client.op.idx_list)
if (len(lst) == 1 and
theano.tensor.extract_constant(lst[0]) == -1):
return True
return False
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论