提交 584e3cd1 authored 作者: Frederic Bastien's avatar Frederic Bastien

Fix a failing test in DebugMode by making DebugMode pickable. Now _Maker do as…

Fix a failing test in DebugMode by making DebugMode pickable. Now _Maker do as FunctionMaker, it use the normal pickle system.
上级 2d3ab3b0
......@@ -10,7 +10,6 @@ import copy
import sys
import gc
import logging
import six.moves.copyreg as copyreg
from itertools import chain, product as itertools_product
from theano.compat import izip
......@@ -2414,10 +2413,6 @@ class _Maker(FunctionMaker): # inheritance buys a few helper functions
return fn
def _pickle_DebugMode_Maker(maker):
raise NotImplementedError('DebugMode is not picklable (yet)')
copyreg.pickle(_Maker, _pickle_DebugMode_Maker)
########################
#
# API symbol: DebugMode
......
......@@ -654,9 +654,13 @@ class T_picklefunction(unittest.TestCase):
def test_output_keys(self):
x = T.vector()
f = theano.function([x], {'vec': x**2})
assert isinstance(f([2, 3, 4]), dict)
o = f([2, 3, 4])
assert isinstance(o, dict)
assert np.allclose(o['vec'], [4, 9, 16])
g = copy.deepcopy(f)
assert isinstance(g([2, 3, 4]), dict)
o = g([2, 3, 4])
assert isinstance(o, dict)
assert np.allclose(o['vec'], [4, 9, 16])
def test_deepcopy_shared_container(self):
# Ensure that shared containers remain shared after a deep copy.
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论