提交 216a6670 authored 作者: Frederic's avatar Frederic

tmp fix to the shapes error with cudnnpool

上级 987a15a5
...@@ -745,8 +745,8 @@ if (err%(name)s != CUDNN_STATUS_SUCCESS) { ...@@ -745,8 +745,8 @@ if (err%(name)s != CUDNN_STATUS_SUCCESS) {
# not connected to desc # not connected to desc
return [[1], [0]] return [[1], [0]]
def c_code_cache_version(self): # def c_code_cache_version(self):
return (3,) # return (3,)
class GpuDnnPoolGrad(DnnBase): class GpuDnnPoolGrad(DnnBase):
......
...@@ -57,8 +57,10 @@ def test_pooling(): ...@@ -57,8 +57,10 @@ def test_pooling():
x = T.ftensor4() x = T.ftensor4()
for func in (T.max, T.mean): for func in (T.max, T.mean):
for ws in (4, 5): for ws in (2, 4, 5):
for stride in (2, 3): for stride in (2, 3):
if stride > ws:
continue
out1 = cuda.dnn.dnn_pool( out1 = cuda.dnn.dnn_pool(
x, ws=(ws, ws), x, ws=(ws, ws),
stride=(stride, stride), stride=(stride, stride),
...@@ -68,13 +70,14 @@ def test_pooling(): ...@@ -68,13 +70,14 @@ def test_pooling():
f1 = theano.function([x], out1, mode=mode_with_gpu) f1 = theano.function([x], out1, mode=mode_with_gpu)
f2 = theano.function([x], out2, mode=mode_with_gpu) f2 = theano.function([x], out2, mode=mode_with_gpu)
for shp in [(1, 10, 100, 100),
data = numpy.random.normal( (1, 3, 99, 99),
0, 1, (1, 10, 100, 100)).astype("float32") (32, 1, 147, 197),
]:
data = numpy.random.normal(0, 1, shp).astype("float32")
a = f1(data).__array__() a = f1(data).__array__()
b = f2(data).__array__() b = f2(data).__array__()
assert numpy.allclose(a, b, assert numpy.allclose(a, b,
atol=numpy.finfo(numpy.float32).eps) atol=numpy.finfo(numpy.float32).eps)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论