提交 1e5432e7 authored 作者: Yikang Shen's avatar Yikang Shen

Flag to disable pickling test values

上级 4747cf44
......@@ -55,6 +55,13 @@ AddConfigVar('warn_float64',
in_c_key=False,
)
AddConfigVar('pickle_test_value',
"Dump test values while pickling model. "
"If True, test values will be dumped with model.",
BoolParam(False),
in_c_key=False,
)
AddConfigVar('cast_policy',
'Rules for implicit type casting',
EnumStr('custom', 'numpy+floatX',
......
......@@ -7,6 +7,8 @@ from collections import deque
from copy import copy
from itertools import count
import warnings
import theano
from theano import config
from theano.gof import utils
......@@ -524,6 +526,11 @@ class Variable(Node):
def __getstate__(self):
d = self.__dict__.copy()
d.pop("_fn_cache", None)
if (not config.pickle_test_value) and (hasattr(self.tag, 'test_value')):
warnings.warn("Test value of variable %s(%s) will not be dumped." % (d['auto_name'], d['name']))
t = d["tag"]
del t.test_value
d["tag"] = t
return d
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论