提交 07e7ebeb 编写于 作者: L LielinJiang 提交者: qingqing01

Fix depthwise conv gpu kernel bug (#18582) (#19392)

* fix depthwise conv gpu kernel bug, test=develop
* add more depthwise conv test, test=develop
上级 ec64f44f
...@@ -487,8 +487,12 @@ class DepthwiseConvFunctor<platform::CUDADeviceContext, T, ...@@ -487,8 +487,12 @@ class DepthwiseConvFunctor<platform::CUDADeviceContext, T,
check_case(1, 2, 3); check_case(1, 2, 3);
check_case(1, 2, 5); check_case(1, 2, 5);
check_case(1, 2, -1); check_case(1, 2, -1);
check_case(0, 0, 3); check_case(2, 1, 3);
check_case(0, 0, 5); check_case(2, 1, 5);
check_case(2, 1, -1);
check_case(2, 2, 3);
check_case(2, 2, 5);
check_case(2, 2, -1);
check_case(0, 0, -1); check_case(0, 0, -1);
// NOTE(liangdun): 0,0 for other case // NOTE(liangdun): 0,0 for other case
// add other case if needed, e.g. check_case(2^n,1) // add other case if needed, e.g. check_case(2^n,1)
......
...@@ -208,6 +208,48 @@ class TestWith1x1(TestConv2dOp): ...@@ -208,6 +208,48 @@ class TestWith1x1(TestConv2dOp):
self.groups = 3 self.groups = 3
class TestWithDepthWise3x3(TestConv2dOp):
def init_test_case(self):
self.pad = [1, 1]
self.stride = [1, 1]
self.input_size = [3, 4, 10, 10] # NCHW
assert np.mod(self.input_size[1], self.groups) == 0
f_c = self.input_size[1] // self.groups
self.filter_size = [8, f_c, 3, 3]
def init_dilation(self):
self.dilations = [2, 2]
def init_group(self):
self.groups = 4
class TestWithDepthWise5x5(TestConv2dOp):
def init_test_case(self):
self.pad = [0, 0]
self.stride = [1, 1]
self.input_size = [2, 4, 10, 10] # NCHW
assert np.mod(self.input_size[1], self.groups) == 0
f_c = self.input_size[1] // self.groups
self.filter_size = [8, f_c, 5, 5]
def init_group(self):
self.groups = 4
class TestWithDepthWise7x7(TestConv2dOp):
def init_test_case(self):
self.pad = [1, 1]
self.stride = [2, 2]
self.input_size = [2, 8, 10, 10] # NCHW
assert np.mod(self.input_size[1], self.groups) == 0
f_c = self.input_size[1] // self.groups
self.filter_size = [16, f_c, 7, 7]
def init_group(self):
self.groups = 8
class TestWithDilation(TestConv2dOp): class TestWithDilation(TestConv2dOp):
def init_test_case(self): def init_test_case(self):
self.pad = [0, 0] self.pad = [0, 0]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册