提交 30522195 authored 作者: Frederic Bastien's avatar Frederic Bastien

Work around in a test to be sure we use the defined linker and not the default linker.

上级 8a4ee69c
...@@ -746,7 +746,11 @@ class Conv_opt_test(unittest.TestCase): ...@@ -746,7 +746,11 @@ class Conv_opt_test(unittest.TestCase):
mode = mode_with_gpu.including('conv_meta') mode = mode_with_gpu.including('conv_meta')
ref_func = theano.function([], conv_op, mode=mode_with_gpu) ref_func = theano.function([], conv_op, mode=mode_with_gpu)
conv_func = theano.function([], conv_op, mode=mode) # All meta optimizer compile a new function. This need to know
# the current linker, but this information is not available,
# so it use the default mode.
with theano.change_flags(mode=mode):
conv_func = theano.function([], conv_op, mode=mode)
assert any([isinstance(node.op, op) assert any([isinstance(node.op, op)
for node in conv_func.maker.fgraph.toposort()]) for node in conv_func.maker.fgraph.toposort()])
utt.assert_allclose(conv_func(), ref_func()) utt.assert_allclose(conv_func(), ref_func())
...@@ -788,7 +792,11 @@ class Conv_opt_test(unittest.TestCase): ...@@ -788,7 +792,11 @@ class Conv_opt_test(unittest.TestCase):
mode = mode_with_gpu.including('conv_meta') mode = mode_with_gpu.including('conv_meta')
ref_func = theano.function([], conv_op, mode=mode_with_gpu) ref_func = theano.function([], conv_op, mode=mode_with_gpu)
conv_func = theano.function([], conv_op, mode=mode) # All meta optimizer compile a new function. This need to know
# the current linker, but this information is not available,
# so it use the default mode.
with theano.change_flags(mode=mode):
conv_func = theano.function([], conv_op, mode=mode)
if op is not None: if op is not None:
assert any([isinstance(node.op, op) assert any([isinstance(node.op, op)
for node in conv_func.maker.fgraph.toposort()]) for node in conv_func.maker.fgraph.toposort()])
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论