提交 82a9d523 authored 作者: Frédéric Bastien's avatar Frédéric Bastien

Merge pull request #1899 from abergeron/fix_assert

Add __setstate__ to Assert to handle old versions that don't have .msg.
......@@ -1366,6 +1366,11 @@ class Assert(T.Op):
def __init__(self, msg="Theano Assert failed!"):
self.msg = msg
def __setstate__(self, attrs):
self.__dict__.update(attrs)
if not hasattr(self, 'msg'):
self.msg = "Theano Assert failed!"
def make_node(self, value, *conds):
cond = [T.as_tensor_variable(c) for c in conds]
assert numpy.all([c.type.ndim == 0 for c in cond])
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论