提交 c24f141a authored 作者: Frederic's avatar Frederic

Fix curand op test in FAST_COMPILE

上级 92248832
...@@ -3,14 +3,21 @@ import theano ...@@ -3,14 +3,21 @@ import theano
from theano.sandbox.cuda.rng_curand import CURAND_RandomStreams from theano.sandbox.cuda.rng_curand import CURAND_RandomStreams
from theano.sandbox.rng_mrg import MRG_RandomStreams from theano.sandbox.rng_mrg import MRG_RandomStreams
if theano.config.mode=='FAST_COMPILE':
mode_with_gpu = theano.compile.mode.get_mode('FAST_RUN').including('gpu')
mode_without_gpu = theano.compile.mode.get_mode('FAST_RUN').excluding('gpu')
else:
mode_with_gpu = theano.compile.mode.get_default_mode().including('gpu')
mode_without_gpu = theano.compile.mode.get_default_mode().excluding('gpu')
def test_uniform_basic(): def test_uniform_basic():
rng = CURAND_RandomStreams(234) rng = CURAND_RandomStreams(234)
u0 = rng.uniform((10,10)) u0 = rng.uniform((10,10))
u1 = rng.uniform((10,10)) u1 = rng.uniform((10,10))
f0 = theano.function([], u0) f0 = theano.function([], u0, mode=mode_with_gpu)
f1 = theano.function([], u1) f1 = theano.function([], u1, mode=mode_with_gpu)
v0list = [f0() for i in range(3)] v0list = [f0() for i in range(3)]
v1list = [f1() for i in range(3)] v1list = [f1() for i in range(3)]
...@@ -36,8 +43,8 @@ def test_normal_basic(): ...@@ -36,8 +43,8 @@ def test_normal_basic():
u0 = rng.normal((10,10)) u0 = rng.normal((10,10))
u1 = rng.normal((10,10)) u1 = rng.normal((10,10))
f0 = theano.function([], u0) f0 = theano.function([], u0, mode=mode_with_gpu)
f1 = theano.function([], u1) f1 = theano.function([], u1, mode=mode_with_gpu)
v0list = [f0() for i in range(3)] v0list = [f0() for i in range(3)]
v1list = [f1() for i in range(3)] v1list = [f1() for i in range(3)]
...@@ -88,4 +95,3 @@ def compare_speed(): ...@@ -88,4 +95,3 @@ def compare_speed():
# don't time the first call, it has some startup cost # don't time the first call, it has some startup cost
f.fn.time_thunks = (i>0) f.fn.time_thunks = (i>0)
f() f()
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论