提交 51807e8c authored 作者: Frederic's avatar Frederic

Don't pickle the function used with: a_theano_var.eval(...)

上级 6253b797
......@@ -424,6 +424,10 @@ class Variable(Node):
return rval
def __getstate__(self):
d = self.__dict__.copy()
d.pop("_fn", None)
return d
env = property(env_getter, env_setter, env_deleter)
......
import pickle
import unittest
from theano import tensor
......@@ -292,7 +293,6 @@ class TestIsSameGraph(unittest.TestCase):
debug=False)
################
# eval #
################
......@@ -305,3 +305,6 @@ def test_eval():
result = z.eval({x : 1., y : 2.})
assert result == 3.
# We don't want to pickle the tmp function.
assert not hasattr(pickle.loads(pickle.dumps(z)), '_fn')
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论