提交 7865102b authored 作者: Frederic's avatar Frederic

better test.

上级 3e7dbe34
...@@ -43,6 +43,7 @@ from theano.sandbox.gpuarray.basic_ops import ( ...@@ -43,6 +43,7 @@ from theano.sandbox.gpuarray.basic_ops import (
cuda_from_gpu, HostFromGpu, cuda_from_gpu, HostFromGpu,
GpuFromHost, GpuReshape, GpuFromHost, GpuReshape,
gpu_join, GpuJoin, GpuSplit, GpuEye, gpu_contiguous) gpu_join, GpuJoin, GpuSplit, GpuEye, gpu_contiguous)
from theano.sandbox.gpuarray.subtensor import GpuSubtensor
from theano.tests import unittest_tools as utt from theano.tests import unittest_tools as utt
utt.seed_rng() utt.seed_rng()
...@@ -331,10 +332,12 @@ def test_gpu_contiguous(): ...@@ -331,10 +332,12 @@ def test_gpu_contiguous():
i = T.iscalar('i') i = T.iscalar('i')
a_val = numpy.asarray(numpy.random.rand(4, 5), dtype='float32') a_val = numpy.asarray(numpy.random.rand(4, 5), dtype='float32')
f = theano.function([a, i], gpu_contiguous(a[::i]), f = theano.function([a, i], gpu_contiguous(a[::i]),
mode=mode_without_gpu) mode=mode_with_gpu)
f(a_val, 1) topo = f.maker.fgraph.toposort()
f(a_val, 2) assert any([isinstance(node.op, GpuSubtensor) for node in topo])
theano.printing.debugprint(f) assert f(a_val, 1).flags.c_contiguous
assert f(a_val, 2).flags.c_contiguous
assert f(a_val, 2).flags.c_contiguous
class G_reshape(T_reshape): class G_reshape(T_reshape):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论