提交 d4e7e4f1 authored 作者: Li's avatar Li 提交者: Frederic

support: no need to re-optmize when unpickling theano function. added a new…

support: no need to re-optmize when unpickling theano function. added a new option reoptimize_unpickled_function=False
上级 54bc8d12
......@@ -118,6 +118,7 @@ AddConfigVar('print_active_device',
BoolParam(True, allow_override=False),
in_c_key=False)
# Do not add FAST_RUN_NOGC to this list (nor any other ALL CAPS shortcut).
# The way to get FAST_RUN_NOGC is with the flag 'linker=c|py_nogc'.
# The old all capital letter way of working is deprecated as it is not
......@@ -465,6 +466,12 @@ AddConfigVar('unpickle_function',
BoolParam(True),
in_c_key=False)
AddConfigVar('reoptimize_unpickled_function',
"Re-optimize the graph when a theano function is unpickled from the disk.",
BoolParam(False, allow_override=False),
in_c_key=False)
"""Note to developers:
Generally your exceptions should use an apply node's __str__
method when exception_verbosity == 'low'. When exception_verbosity
......
......@@ -8,7 +8,7 @@ floatX = 'float32'
def test_pickle_unpickle():
# Test if pick and unpickling a theano function with
# shared variables work
# shared variables should be pickled properly
x1 = T.fmatrix('x1')
x2 = T.fmatrix('x2')
x3 = theano.shared(numpy.ones((10,10),dtype=floatX))
......@@ -19,12 +19,12 @@ def test_pickle_unpickle():
updates[x3] = x3 + 1
updates[x4] = x4 + 1
f = theano.function([x1,x2],y, updates=updates)
pkl_path = open('thean_fn.pkl','wb')
cPickle.dump(f, pkl_path, -1)
pkl_path = open('thean_fn.pkl','r')
f_ = cPickle.load(pkl_path)
import ipdb; ipdb.set_trace()
in1 = numpy.ones((10, 10), dtype=floatX)
in2 = numpy.ones((10, 10), dtype=floatX)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论