提交 b14af85f authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Fix test of DebugMode.check_preallocated_output

上级 5cd26de6
...@@ -664,26 +664,19 @@ class Test_preallocated_output(unittest.TestCase): ...@@ -664,26 +664,19 @@ class Test_preallocated_output(unittest.TestCase):
a_val = rng.randn(7, 7).astype('float32') a_val = rng.randn(7, 7).astype('float32')
b_val = rng.randn(7, 7).astype('float32') b_val = rng.randn(7, 7).astype('float32')
init_conf_val = config.DebugMode.check_preallocated_output
try:
# Should work # Should work
config.DebugMode.check_preallocated_output = 'c_contiguous' mode = debugmode.DebugMode(
check_preallocated_output=['c_contiguous'])
f = theano.function([a, b], out, mode='DEBUG_MODE') f = theano.function([a, b], out, mode=mode)
out_val = f(a_val, b_val) out_val = f(a_val, b_val)
#print 'out_val =', out_val #print 'out_val =', out_val
#print out_val.strides #print out_val.strides
# Should work for now (0.4.0), because the C thunk does not care # Should raise an Exception, since the output buffer is
# at all of what is in storage_map initially. # used incorrectly.
# When it changes, the call to f should raise an Exception, mode = debugmode.DebugMode(
# since the output buffer is used incorrectly. check_preallocated_output=['f_contiguous'])
config.DebugMode.check_preallocated_output = 'f_contiguous'
f = theano.function([a, b], out, mode='DEBUG_MODE')
out_val = f(a_val, b_val)
#print 'out_val =', out_val
#print out_val.strides
finally: f = theano.function([a, b], out, mode=mode)
config.DebugMode.check_preallocated_output = init_conf_val self.assertRaises(debugmode.BadCLinkerOutput, f, a_val, b_val)
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论