提交 baaa965d authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Add test to check that theano.shared sends float32 arrays to GPU if possible.

上级 21ccb530
...@@ -800,6 +800,17 @@ def test_duplicate_arg_elemwise(): ...@@ -800,6 +800,17 @@ def test_duplicate_arg_elemwise():
assert numpy.allclose(Bval,f(Aval)) assert numpy.allclose(Bval,f(Aval))
def test_shared_float32():
'''Test use of cuda.shared_constructor through theano.shared'''
# Register cuda.shared_constructor in theano.shared
theano.shared.constructors.append(cuda.shared_constructor)
a = theano.shared(numpy.ones((2,3), dtype='float32'))
assert isinstance(a.type, tcn.CudaNdarrayType)
# Unregister
del theano.shared.constructors[-1]
import theano.tensor.tests.test_basic import theano.tensor.tests.test_basic
test_shared_options = theano.tensor.tests.test_basic.makeSharedTester( test_shared_options = theano.tensor.tests.test_basic.makeSharedTester(
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论