提交 443f8e27 authored 作者: Frederic's avatar Frederic

fix test, opt changed name

上级 1a369c4d
...@@ -201,10 +201,10 @@ class TestDnnInferShapes(utt.InferShapeTester): ...@@ -201,10 +201,10 @@ class TestDnnInferShapes(utt.InferShapeTester):
super(TestDnnInferShapes, self).setUp() super(TestDnnInferShapes, self).setUp()
def test_softmax(self): def test_softmax(self):
t = T.tensor4('t') t = T.ftensor4('t')
rand_tensor = numpy.asarray( rand_tensor = numpy.asarray(
numpy.random.rand(5, 4, 3, 2), numpy.random.rand(5, 4, 3, 2),
dtype=theano.config.floatX dtype='float32'
) )
self._compile_and_check( self._compile_and_check(
[t], [t],
...@@ -230,15 +230,15 @@ class TestDnnInferShapes(utt.InferShapeTester): ...@@ -230,15 +230,15 @@ class TestDnnInferShapes(utt.InferShapeTester):
) )
def test_conv(self): def test_conv(self):
img = T.tensor4('img') img = T.ftensor4('img')
kerns = T.tensor4('kerns') kerns = T.ftensor4('kerns')
img_val = numpy.asarray( img_val = numpy.asarray(
numpy.random.rand(3, 4, 5, 6), numpy.random.rand(3, 4, 5, 6),
dtype=theano.config.floatX dtype='float32'
) )
kern_vals = numpy.asarray( kern_vals = numpy.asarray(
numpy.random.rand(3, 4, 5, 6), numpy.random.rand(3, 4, 5, 6),
dtype=theano.config.floatX dtype='float32'
) )
for params in product( for params in product(
...@@ -260,15 +260,15 @@ class TestDnnInferShapes(utt.InferShapeTester): ...@@ -260,15 +260,15 @@ class TestDnnInferShapes(utt.InferShapeTester):
) )
def test_conv_gradw(self): def test_conv_gradw(self):
img = T.tensor4('img') img = T.ftensor4('img')
kerns = T.tensor4('kerns') kerns = T.ftensor4('kerns')
img_val = numpy.asarray( img_val = numpy.asarray(
numpy.random.rand(3, 4, 5, 6), numpy.random.rand(3, 4, 5, 6),
dtype=theano.config.floatX dtype='float32'
) )
kern_vals = numpy.asarray( kern_vals = numpy.asarray(
numpy.random.rand(3, 4, 5, 6), numpy.random.rand(3, 4, 5, 6),
dtype=theano.config.floatX dtype='float32'
) )
for params in product( for params in product(
...@@ -306,15 +306,15 @@ class TestDnnInferShapes(utt.InferShapeTester): ...@@ -306,15 +306,15 @@ class TestDnnInferShapes(utt.InferShapeTester):
) )
def test_conv_gradi(self): def test_conv_gradi(self):
img = T.tensor4('img') img = T.ftensor4('img')
kerns = T.tensor4('kerns') kerns = T.ftensor4('kerns')
img_val = numpy.asarray( img_val = numpy.asarray(
numpy.random.rand(3, 4, 5, 6), numpy.random.rand(3, 4, 5, 6),
dtype=theano.config.floatX dtype='float32'
) )
kern_vals = numpy.asarray( kern_vals = numpy.asarray(
numpy.random.rand(3, 4, 5, 6), numpy.random.rand(3, 4, 5, 6),
dtype=theano.config.floatX dtype='float32'
) )
for params in product( for params in product(
...@@ -349,10 +349,10 @@ class TestDnnInferShapes(utt.InferShapeTester): ...@@ -349,10 +349,10 @@ class TestDnnInferShapes(utt.InferShapeTester):
) )
def test_pool(self): def test_pool(self):
img = T.tensor4('img') img = T.ftensor4('img')
img_val = numpy.asarray( img_val = numpy.asarray(
numpy.random.rand(2, 3, 4, 5), numpy.random.rand(2, 3, 4, 5),
dtype=theano.config.floatX dtype='float32'
) )
for params in product( for params in product(
[(1, 1), (2, 2), (3, 3)], [(1, 1), (2, 2), (3, 3)],
...@@ -372,20 +372,20 @@ class TestDnnInferShapes(utt.InferShapeTester): ...@@ -372,20 +372,20 @@ class TestDnnInferShapes(utt.InferShapeTester):
) )
def test_pool_grad(self): def test_pool_grad(self):
img = T.tensor4('img') img = T.ftensor4('img')
img_grad = T.tensor4('img_grad') img_grad = T.ftensor4('img_grad')
out = T.tensor4('out') out = T.ftensor4('out')
img_val = numpy.asarray( img_val = numpy.asarray(
numpy.random.rand(2, 3, 4, 5), numpy.random.rand(2, 3, 4, 5),
dtype=theano.config.floatX dtype='float32'
) )
img_grad_val = numpy.asarray( img_grad_val = numpy.asarray(
numpy.random.rand(2, 3, 4, 5), numpy.random.rand(2, 3, 4, 5),
dtype=theano.config.floatX dtype='float32'
) )
out_val = numpy.asarray( out_val = numpy.asarray(
numpy.random.rand(2, 3, 4, 5), numpy.random.rand(2, 3, 4, 5),
dtype=theano.config.floatX dtype='float32'
) )
for params in product( for params in product(
......
...@@ -81,7 +81,7 @@ def test_gpualloc(): ...@@ -81,7 +81,7 @@ def test_gpualloc():
m = (x).dimshuffle(['x', 0]) m = (x).dimshuffle(['x', 0])
v = tensor.alloc(1., *m.shape) v = tensor.alloc(1., *m.shape)
f = theano.function([], v + x, f = theano.function([], v + x,
mode=mode_with_gpu.excluding("local_alloc_elemwise")) mode=mode_with_gpu.excluding("local_elemwise_alloc"))
l = f.maker.fgraph.toposort() l = f.maker.fgraph.toposort()
assert numpy.any([isinstance(x.op, cuda.GpuAlloc) for x in l]) assert numpy.any([isinstance(x.op, cuda.GpuAlloc) for x in l])
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论