提交 75f0652f authored 作者: Frederic's avatar Frederic

Reset the flags if the tests crash and fix the test in debug mode.

上级 e8b30662
...@@ -11,7 +11,7 @@ def test_profiling(): ...@@ -11,7 +11,7 @@ def test_profiling():
old1 = theano.config.profile old1 = theano.config.profile
old2 = theano.config.profile_memory old2 = theano.config.profile_memory
try:
theano.config.profile = True theano.config.profile = True
theano.config.profile_memory = True theano.config.profile_memory = True
...@@ -19,12 +19,17 @@ def test_profiling(): ...@@ -19,12 +19,17 @@ def test_profiling():
y = T.dvector("y") y = T.dvector("y")
z = x + y z = x + y
p = theano.ProfileStats(False) p = theano.ProfileStats(False)
f = theano.function([x, y], z, profile=p, name="test_profiling") if theano.config.mode in ["DebugMode", "DEBUG_MODE"]:
m = "FAST_RUN"
else:
m = None
f = theano.function([x, y], z, profile=p, name="test_profiling",
mode=m)
output = f([1, 2, 3, 4], [1, 1, 1, 1]) output = f([1, 2, 3, 4], [1, 1, 1, 1])
buf = StringIO.StringIO() buf = StringIO.StringIO()
f.profile.summary(buf) f.profile.summary(buf)
finally:
theano.config.profile = old1 theano.config.profile = old1
theano.config.profile_memory = old2 theano.config.profile_memory = old2
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论