提交 26364b9c authored 作者: Frederic Bastien's avatar Frederic Bastien

add test for the optimization local_gpu_elemwise_1 for the huge GpuElemwise problem.

上级 15fcf194
......@@ -769,11 +769,22 @@ def test_many_arg_elemwise():
outputs = []
for mode in [ mode_with_gpu, mode_without_gpu ]:
f = theano.function( symb_args, op_to_test(*symb_args), mode = mode )
#test the optijmization local_gpu_elemwise_0
f = theano.function( symb_args, op_to_test(*symb_args), mode = mode.excluding("local_gpu_elemwise_1") )
outputs.append( f( * args) )
#assert that the test was done on the gpu.
if mode is mode_with_gpu:
assert any([isinstance(node.op, cuda.GpuElemwise) for node in f.maker.env.nodes])
#test the optijmization local_gpu_elemwise_1
f = theano.function( symb_args,
cuda.gpu_from_host(op_to_test(*symb_args)),
mode = mode.excluding("local_gpu_elemwise_0") )
out = f( * args)
#assert that the test was done on the gpu.
if mode is mode_with_gpu:
assert any([isinstance(node.op, cuda.GpuElemwise) for node in f.maker.env.nodes])
assert numpy.allclose(out, outputs[-1])
results_gpu, results_cpu = outputs
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论