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

Merge pull request #2884 from nouiz/gpu_test

[TEST] fix buildbot Gpu test
...@@ -389,7 +389,7 @@ def test_alloc_empty(): ...@@ -389,7 +389,7 @@ def test_alloc_empty():
assert out[1].shape == (2, 3) assert out[1].shape == (2, 3)
assert out[1].dtype == 'float32' assert out[1].dtype == 'float32'
assert len([node for node in f.maker.fgraph.apply_nodes assert len([node for node in f.maker.fgraph.apply_nodes
if isinstance(node.op, cuda.basic_ops.GpuAllocEmpty)]) == 2 if isinstance(node.op, cuda.basic_ops.GpuAllocEmpty)]) == 1
def test_elemwise_empty(): def test_elemwise_empty():
......
...@@ -325,10 +325,10 @@ def test_opt_gpujoin_joinvectors_negativeaxes(): ...@@ -325,10 +325,10 @@ def test_opt_gpujoin_joinvectors_negativeaxes():
rng = numpy.random.RandomState(22) rng = numpy.random.RandomState(22)
x1 = rng.rand(5) x1 = rng.rand(5)
x2 = rng.rand(10) x2 = rng.rand(10)
t1 = shared(numpy.asarray(x1, theano.config.floatX)) t1 = cuda.shared_constructor(numpy.asarray(x1, "float32"))
t2 = shared(numpy.asarray(x2, theano.config.floatX)) t2 = cuda.shared_constructor(numpy.asarray(x2, "float32"))
t = T.concatenate([t1, t2], axis=-1) t = tensor.concatenate([t1, t2], axis=-1)
f = theano.function(inputs=[], outputs=t) f = theano.function(inputs=[], outputs=t)
assert(numpy.allclose(f(), numpy.concatenate([x1, x2], axis=-1))) assert(numpy.allclose(f(), numpy.concatenate([x1, x2], axis=-1)))
...@@ -336,18 +336,18 @@ def test_opt_gpujoin_joinvectors_negativeaxes(): ...@@ -336,18 +336,18 @@ def test_opt_gpujoin_joinvectors_negativeaxes():
# Test case for two-dimensional vectors # Test case for two-dimensional vectors
x1 = rng.rand(5, 10) x1 = rng.rand(5, 10)
x2 = rng.rand(10, 10) x2 = rng.rand(10, 10)
t1 = shared(numpy.asarray(x1, theano.config.floatX)) t1 = cuda.shared_constructor(numpy.asarray(x1, "float32"))
t2 = shared(numpy.asarray(x2, theano.config.floatX)) t2 = cuda.shared_constructor(numpy.asarray(x2, "float32"))
t = T.concatenate([t1, t2], axis=-2) t = tensor.concatenate([t1, t2], axis=-2)
f = theano.function(inputs=[], outputs=t) f = theano.function(inputs=[], outputs=t)
assert(numpy.allclose(f(), numpy.concatenate([x1, x2], axis=-2))) assert(numpy.allclose(f(), numpy.concatenate([x1, x2], axis=-2)))
# Now check that a value error is raised when vectors don't match # Now check that a value error is raised when vectors don't match
# along the negative concatenation axis # along the negative concatenation axis
try: try:
t = T.concatenate([t1, t2], axis=-1) t = tensor.concatenate([t1, t2], axis=-1)
f = theano.function(inputs=[], outputs=t) f = theano.function(inputs=[], outputs=t)
f() f()
assert(False) assert(False)
...@@ -357,7 +357,7 @@ def test_opt_gpujoin_joinvectors_negativeaxes(): ...@@ -357,7 +357,7 @@ def test_opt_gpujoin_joinvectors_negativeaxes():
# Finally check that a value error is raised when negative # Finally check that a value error is raised when negative
# axis is larger in absolute value than smallest number of dims # axis is larger in absolute value than smallest number of dims
try: try:
t = T.concatenate([t1, t2], axis=-3) t = tensor.concatenate([t1, t2], axis=-3)
f = theano.function(inputs=[], outputs=t) f = theano.function(inputs=[], outputs=t)
f() f()
assert(False) assert(False)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论