提交 5a024d83 authored 作者: Frederic's avatar Frederic

Add a test for the fix above

上级 dc166276
import os
import pickle import pickle
import unittest import unittest
import theano import theano
from theano.compat.six import PY3
from theano.gof import CachedConstantError, FunctionGraph from theano.gof import CachedConstantError, FunctionGraph
from theano import tensor as tt from theano import tensor as tt
...@@ -24,3 +26,21 @@ class TFunctionGraph(unittest.TestCase): ...@@ -24,3 +26,21 @@ class TFunctionGraph(unittest.TestCase):
s = pickle.dumps(func) s = pickle.dumps(func)
func2 = pickle.loads(s) func2 = pickle.loads(s)
def test_node_outputs_not_used(self):
"""In the past, we where removing some not used variable from
fgraph.variables event if the apply had other output used in
the graph. This caused a crash.
This test run the pickle that reproduce this case.
"""
with open(os.path.join(os.path.dirname(__file__),
'test_fg_old_crash.pkl'),
'rb') as f:
from theano.misc.pkl_utils import CompatUnpickler
if PY3:
u = CompatUnpickler(f, encoding="latin1")
else:
u = CompatUnpickler(f)
d = u.load()
f = theano.function(**d)
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论