提交 a6baa2e8 authored 作者: Yikang Shen's avatar Yikang Shen

set default value to True & debug

上级 1e5432e7
......@@ -58,7 +58,7 @@ AddConfigVar('warn_float64',
AddConfigVar('pickle_test_value',
"Dump test values while pickling model. "
"If True, test values will be dumped with model.",
BoolParam(False),
BoolParam(True),
in_c_key=False,
)
......
......@@ -526,9 +526,12 @@ 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"]
if (not config.pickle_test_value) \
and (hasattr(self.tag, 'test_value')) \
and (not type(config).pickle_test_value.is_default):
warnings.warn("pickle_test_value is not defaut value (True).\n"
"Test value of variable %s(%s) will not be dumped." % (d['auto_name'], d['name']))
t = copy(d["tag"])
del t.test_value
d["tag"] = t
return d
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论