提交 7dab9f38 authored 作者: Frederic Bastien's avatar Frederic Bastien

make rng test on gpu fully on gpu

上级 4b00bd50
...@@ -24,7 +24,8 @@ from theano.tests import unittest_tools as utt ...@@ -24,7 +24,8 @@ from theano.tests import unittest_tools as utt
#TODO: bug fix test_normal0, in normal() fct, n_samples currently need to be numpy.prod(size) not self.n_streams(size) #TODO: bug fix test_normal0, in normal() fct, n_samples currently need to be numpy.prod(size) not self.n_streams(size)
mode = theano.config.mode mode = config.mode
mode_with_gpu = theano.compile.mode.get_default_mode().including('gpu')
utt.seed_rng() utt.seed_rng()
## Results generated by Java code using L'Ecuyer et al.'s code, with: ## Results generated by Java code using L'Ecuyer et al.'s code, with:
...@@ -351,7 +352,7 @@ def test_uniform(): ...@@ -351,7 +352,7 @@ def test_uniform():
assert u.dtype == 'float32' #well, it's really that this test w GPU doesn't make sense otw assert u.dtype == 'float32' #well, it's really that this test w GPU doesn't make sense otw
f = theano.function(var_input, theano.Out( f = theano.function(var_input, theano.Out(
theano.sandbox.cuda.basic_ops.gpu_from_host(u), theano.sandbox.cuda.basic_ops.gpu_from_host(u),
borrow=True), mode=mode) borrow=True), mode=mode_with_gpu)
assert any([isinstance(node.op,theano.sandbox.rng_mrg.GPU_mrg_uniform) assert any([isinstance(node.op,theano.sandbox.rng_mrg.GPU_mrg_uniform)
for node in f.maker.env.toposort()]) for node in f.maker.env.toposort()])
theano.printing.debugprint(f) theano.printing.debugprint(f)
...@@ -409,7 +410,7 @@ def test_binomial(): ...@@ -409,7 +410,7 @@ def test_binomial():
assert u.dtype == 'float32' #well, it's really that this test w GPU doesn't make sense otw assert u.dtype == 'float32' #well, it's really that this test w GPU doesn't make sense otw
f = theano.function(var_input, theano.Out( f = theano.function(var_input, theano.Out(
theano.sandbox.cuda.basic_ops.gpu_from_host(u), theano.sandbox.cuda.basic_ops.gpu_from_host(u),
borrow=True), mode=mode) borrow=True), mode=mode_with_gpu)
theano.printing.debugprint(f) theano.printing.debugprint(f)
out = numpy.asarray(f(*input)) out = numpy.asarray(f(*input))
print 'random?[:10]\n', out[0,0:10] print 'random?[:10]\n', out[0,0:10]
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论