提交 2aed75fb authored 作者: Arnaud Bergeron's avatar Arnaud Bergeron

Add __setstate__ to Assert to handle old versions that don't have .msg.

上级 8a2a715d
......@@ -1366,6 +1366,10 @@ class Assert(T.Op):
def __init__(self, msg="Theano Assert failed!"):
self.msg = msg
def __setstate__(self, attrs):
self.msg = attrs.pop('msg', "Theano Assert failed!")
super(Assert, self).__setstate__(attrs)
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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论