提交 720355c3 authored 作者: Harm de Vries's avatar Harm de Vries

fix other tests

上级 51928399
...@@ -40,9 +40,9 @@ def raise_no_cudnn(msg="CuDNN is required for convolution and pooling"): ...@@ -40,9 +40,9 @@ def raise_no_cudnn(msg="CuDNN is required for convolution and pooling"):
def _dnn_check_compile(): def _dnn_check_compile():
preambule = """ preambule = """
# include <stdio.h> #include <stdio.h>
# include <cudnn.h> #include <cudnn.h>
# include <cudnn_helper.h> #include <cudnn_helper.h>
""" """
# No need for the context in here since we won't execute that code # No need for the context in here since we won't execute that code
...@@ -201,9 +201,9 @@ class DnnVersion(Op): ...@@ -201,9 +201,9 @@ class DnnVersion(Op):
def c_support_code(self): def c_support_code(self):
return """ return """
# if PY_MAJOR_VERSION >= 3 #if PY_MAJOR_VERSION >= 3
# define PyInt_FromLong PyLong_FromLong #define PyInt_FromLong PyLong_FromLong
# endif #endif
""" """
def make_node(self): def make_node(self):
...@@ -1090,7 +1090,7 @@ class GpuDnnPool(DnnBase): ...@@ -1090,7 +1090,7 @@ class GpuDnnPool(DnnBase):
return [('MODE_FLAG', mode_flag)] return [('MODE_FLAG', mode_flag)]
def make_node(self, img, ws, stride, pad): def make_node(self, img, ws, stride, pad):
ctx_name = infer_context_name(img, ws, stride, pad) ctx_name = infer_context_name(img)
img = as_gpuarray_variable(img, ctx_name) img = as_gpuarray_variable(img, ctx_name)
ws = tensor.as_tensor_variable(ws) ws = tensor.as_tensor_variable(ws)
......
...@@ -574,14 +574,9 @@ class TestDnnInferShapes(utt.InferShapeTester): ...@@ -574,14 +574,9 @@ class TestDnnInferShapes(utt.InferShapeTester):
[(1, 1), (2, 2), (3, 3)], [(1, 1), (2, 2), (3, 3)],
modes modes
): ):
desc = dnn.GpuDnnPoolDesc(
ws=params[0],
stride=params[1],
mode=params[2]
)()
self._compile_and_check( self._compile_and_check(
[img], [img],
[dnn.GpuDnnPool()(img, desc)], [dnn.GpuDnnPool(mode=params[2])(img, params[0], params[1], (0, 0))],
[img_val], [img_val],
dnn.GpuDnnPool dnn.GpuDnnPool
) )
...@@ -610,16 +605,13 @@ class TestDnnInferShapes(utt.InferShapeTester): ...@@ -610,16 +605,13 @@ class TestDnnInferShapes(utt.InferShapeTester):
[(1, 1), (2, 2), (3, 3)], [(1, 1), (2, 2), (3, 3)],
['max', 'average_inc_pad'] ['max', 'average_inc_pad']
): ):
desc = dnn.GpuDnnPoolDesc( pool_grad = dnn.GpuDnnPoolGrad(mode=params[2])(
ws=params[0],
stride=params[1],
mode=params[2]
)()
pool_grad = dnn.GpuDnnPoolGrad()(
img, img,
out, out,
img_grad, img_grad,
desc params[0],
params[1],
(0, 0)
) )
self._compile_and_check( self._compile_and_check(
[img, img_grad, out], [img, img_grad, out],
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论