From c8b90d8f9a78328516864b05bf84fc88dfb3d383 Mon Sep 17 00:00:00 2001 From: Bai Yifan Date: Wed, 5 Feb 2020 10:26:54 +0800 Subject: [PATCH] fix deformable_conv small cases, test=develop (#22441) --- .../unittests/test_deformable_conv_op.py | 31 +++---------------- .../white_list/check_shape_white_list.py | 1 - 2 files changed, 5 insertions(+), 27 deletions(-) diff --git a/python/paddle/fluid/tests/unittests/test_deformable_conv_op.py b/python/paddle/fluid/tests/unittests/test_deformable_conv_op.py index 513930d114..13651be800 100644 --- a/python/paddle/fluid/tests/unittests/test_deformable_conv_op.py +++ b/python/paddle/fluid/tests/unittests/test_deformable_conv_op.py @@ -154,32 +154,11 @@ class TestModulatedDeformableConvOp(OpTest): 'Output', max_relative_error=0.05) - def test_check_grad_no_filter(self): - self.check_grad( - ['Input', 'Offset', 'Mask'], - 'Output', - max_relative_error=0.1, - no_grad_set=set(['Filter'])) - - def test_check_grad_no_input(self): - self.check_grad( - ['Filter', 'Offset', 'Mask'], - 'Output', - max_relative_error=0.1, - no_grad_set=set(['Input'])) - - def test_check_grad_no_offset_no_mask(self): - self.check_grad( - ['Input', 'Filter'], - 'Output', - max_relative_error=0.1, - no_grad_set=set(['Offset', 'Mask'])) - def init_test_case(self): self.pad = [1, 1] self.stride = [1, 1] self.dilations = [1, 1] - self.input_size = [2, 4, 4, 4] # NCHW + self.input_size = [2, 8, 4, 4] # NCHW assert np.mod(self.input_size[1], self.groups) == 0 f_c = self.input_size[1] // self.groups self.filter_size = [4, f_c, 3, 3] @@ -229,7 +208,7 @@ class TestWithDilation(TestModulatedDeformableConvOp): def init_test_case(self): self.pad = [2, 2] self.stride = [1, 1] - self.input_size = [2, 3, 4, 4] # NCHW + self.input_size = [4, 3, 4, 4] # NCHW assert np.mod(self.input_size[1], self.groups) == 0 f_c = self.input_size[1] // self.groups self.filter_size = [6, f_c, 3, 3] @@ -250,14 +229,14 @@ class TestWithDilation(TestModulatedDeformableConvOp): self.dilations = [2, 2] -class TestWith1x1(TestModulatedDeformableConvOp): +class TestWith3x3(TestModulatedDeformableConvOp): def init_test_case(self): - self.pad = [0, 0] + self.pad = [1, 1] self.stride = [1, 1] self.input_size = [2, 3, 5, 5] # NCHW assert np.mod(self.input_size[1], self.groups) == 0 f_c = self.input_size[1] // self.groups - self.filter_size = [6, f_c, 1, 1] + self.filter_size = [6, f_c, 3, 3] self.im2col_step = 1 self.deformable_groups = 1 offset_c = 2 * self.deformable_groups * self.filter_size[ diff --git a/python/paddle/fluid/tests/unittests/white_list/check_shape_white_list.py b/python/paddle/fluid/tests/unittests/white_list/check_shape_white_list.py index 4ed37162de..82d86fd2e5 100644 --- a/python/paddle/fluid/tests/unittests/white_list/check_shape_white_list.py +++ b/python/paddle/fluid/tests/unittests/white_list/check_shape_white_list.py @@ -21,7 +21,6 @@ NEED_TO_FIX_OP_LIST = [ 'fused_elemwise_activation', 'bilinear_tensor_product', 'conv2d_transpose', - 'deformable_conv', 'depthwise_conv2d_transpose', 'grid_sampler', 'hierarchical_sigmoid', -- GitLab