提交 2b619493 编写于 作者: Z zhupengyang 提交者: Tao Luo

all cases use large shape (#22241)

enhanced ops: concat, nearest_interp, deformable_conv_v1, sequence_conv, transpose2, conv2d
上级 07afc29e
...@@ -156,6 +156,14 @@ class TestWithStride(TestConv2dMKLDNNOp): ...@@ -156,6 +156,14 @@ class TestWithStride(TestConv2dMKLDNNOp):
class TestWithGroup(TestConv2dMKLDNNOp): class TestWithGroup(TestConv2dMKLDNNOp):
def init_test_case(self):
self.pad = [0, 0]
self.stride = [1, 1]
self.input_size = [2, 6, 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, 3, 3]
def init_group(self): def init_group(self):
self.groups = 3 self.groups = 3
...@@ -163,13 +171,13 @@ class TestWithGroup(TestConv2dMKLDNNOp): ...@@ -163,13 +171,13 @@ class TestWithGroup(TestConv2dMKLDNNOp):
class TestWith1x1(TestConv2dMKLDNNOp): class TestWith1x1(TestConv2dMKLDNNOp):
def init_test_case(self): def init_test_case(self):
TestConv2dMKLDNNOp.init_test_case(self) TestConv2dMKLDNNOp.init_test_case(self)
self.filter_size = [6, 3, 1, 1] self.filter_size = [40, 3, 1, 1]
class TestWithInput1x1Filter1x1(TestConv2dMKLDNNOp): class TestWithInput1x1Filter1x1(TestConv2dMKLDNNOp):
def init_test_case(self): def init_test_case(self):
TestConv2dMKLDNNOp.init_test_case(self) TestConv2dMKLDNNOp.init_test_case(self)
self.input_size = [2, 3, 1, 1] # NCHW self.input_size = [2, 60, 1, 1] # NCHW
assert np.mod(self.input_size[1], self.groups) == 0 assert np.mod(self.input_size[1], self.groups) == 0
f_c = self.input_size[1] // self.groups f_c = self.input_size[1] // self.groups
self.filter_size = [6, f_c, 1, 1] self.filter_size = [6, f_c, 1, 1]
......
...@@ -60,13 +60,13 @@ class TestCase0MKLDNN(TestTransposeMKLDNN): ...@@ -60,13 +60,13 @@ class TestCase0MKLDNN(TestTransposeMKLDNN):
class TestCase1a(TestTransposeMKLDNN): class TestCase1a(TestTransposeMKLDNN):
def initTestCase(self): def initTestCase(self):
self.shape = (3, 4, 5) self.shape = (3, 4, 10)
self.axis = (0, 2, 1) self.axis = (0, 2, 1)
class TestCase1b(TestTransposeMKLDNN): class TestCase1b(TestTransposeMKLDNN):
def initTestCase(self): def initTestCase(self):
self.shape = (3, 4, 5) self.shape = (3, 4, 10)
self.axis = (2, 1, 0) self.axis = (2, 1, 0)
......
...@@ -194,7 +194,7 @@ class TestSeqProjectCase1(TestSeqProject): ...@@ -194,7 +194,7 @@ class TestSeqProjectCase1(TestSeqProject):
self.padding_trainable = True self.padding_trainable = True
self.context_stride = 1 self.context_stride = 1
self.input_size = [self.input_row, 23] self.input_size = [self.input_row, 50]
offset_lod = [[0, 4, 5, 8, self.input_row]] offset_lod = [[0, 4, 5, 8, self.input_row]]
self.lod = [[]] self.lod = [[]]
# convert from offset-based lod to length-based lod # convert from offset-based lod to length-based lod
...@@ -211,7 +211,7 @@ class TestSeqProjectCase2Len0(TestSeqProject): ...@@ -211,7 +211,7 @@ class TestSeqProjectCase2Len0(TestSeqProject):
self.padding_trainable = True self.padding_trainable = True
self.context_stride = 1 self.context_stride = 1
self.input_size = [self.input_row, 23] self.input_size = [self.input_row, 50]
offset_lod = [[0, 0, 4, 5, 5, 8, self.input_row, self.input_row]] offset_lod = [[0, 0, 4, 5, 5, 8, self.input_row, self.input_row]]
self.lod = [[]] self.lod = [[]]
# convert from offset-based lod to length-based lod # convert from offset-based lod to length-based lod
...@@ -228,7 +228,7 @@ class TestSeqProjectCase3(TestSeqProject): ...@@ -228,7 +228,7 @@ class TestSeqProjectCase3(TestSeqProject):
self.padding_trainable = True self.padding_trainable = True
self.context_stride = 1 self.context_stride = 1
self.input_size = [self.input_row, 23] self.input_size = [self.input_row, 25]
idx = list(range(self.input_size[0])) idx = list(range(self.input_size[0]))
del idx[0] del idx[0]
offset_lod = [[0] + np.sort(random.sample(idx, 8)).tolist() + offset_lod = [[0] + np.sort(random.sample(idx, 8)).tolist() +
......
...@@ -51,9 +51,9 @@ class TestConcatOp(OpTest): ...@@ -51,9 +51,9 @@ class TestConcatOp(OpTest):
self.check_grad(['x2'], 'Out') self.check_grad(['x2'], 'Out')
def init_test_data(self): def init_test_data(self):
self.x0 = np.random.random((2, 1, 4, 5)).astype(self.dtype) self.x0 = np.random.random((5, 1, 4, 5)).astype(self.dtype)
self.x1 = np.random.random((2, 2, 4, 5)).astype(self.dtype) self.x1 = np.random.random((5, 2, 4, 5)).astype(self.dtype)
self.x2 = np.random.random((2, 3, 4, 5)).astype(self.dtype) self.x2 = np.random.random((5, 3, 4, 5)).astype(self.dtype)
self.axis = 1 self.axis = 1
...@@ -94,9 +94,9 @@ class TestConcatOp4(TestConcatOp): ...@@ -94,9 +94,9 @@ class TestConcatOp4(TestConcatOp):
class TestConcatOp5(TestConcatOp): class TestConcatOp5(TestConcatOp):
def init_test_data(self): def init_test_data(self):
self.x0 = np.random.random((2, 1, 4, 5)).astype(self.dtype) self.x0 = np.random.random((5, 1, 4, 5)).astype(self.dtype)
self.x1 = np.random.random((2, 2, 4, 5)).astype(self.dtype) self.x1 = np.random.random((5, 2, 4, 5)).astype(self.dtype)
self.x2 = np.random.random((2, 3, 4, 5)).astype(self.dtype) self.x2 = np.random.random((5, 3, 4, 5)).astype(self.dtype)
self.axis = -3 self.axis = -3
......
...@@ -198,7 +198,7 @@ class TestWithDilation(TestModulatedDeformableConvOp): ...@@ -198,7 +198,7 @@ class TestWithDilation(TestModulatedDeformableConvOp):
def init_test_case(self): def init_test_case(self):
self.pad = [2, 2] self.pad = [2, 2]
self.stride = [1, 1] self.stride = [1, 1]
self.input_size = [2, 3, 4, 4] # NCHW self.input_size = [5, 3, 4, 4] # NCHW
assert np.mod(self.input_size[1], self.groups) == 0 assert np.mod(self.input_size[1], self.groups) == 0
f_c = self.input_size[1] // self.groups f_c = self.input_size[1] // self.groups
self.filter_size = [6, f_c, 3, 3] self.filter_size = [6, f_c, 3, 3]
...@@ -221,7 +221,7 @@ class TestWith1x1(TestModulatedDeformableConvOp): ...@@ -221,7 +221,7 @@ class TestWith1x1(TestModulatedDeformableConvOp):
self.input_size = [2, 3, 5, 5] # NCHW self.input_size = [2, 3, 5, 5] # NCHW
assert np.mod(self.input_size[1], self.groups) == 0 assert np.mod(self.input_size[1], self.groups) == 0
f_c = self.input_size[1] // self.groups f_c = self.input_size[1] // self.groups
self.filter_size = [6, f_c, 1, 1] self.filter_size = [40, f_c, 1, 1]
self.im2col_step = 1 self.im2col_step = 1
self.deformable_groups = 1 self.deformable_groups = 1
offset_c = 2 * self.deformable_groups * self.filter_size[ offset_c = 2 * self.deformable_groups * self.filter_size[
...@@ -232,6 +232,22 @@ class TestWith1x1(TestModulatedDeformableConvOp): ...@@ -232,6 +232,22 @@ class TestWith1x1(TestModulatedDeformableConvOp):
class TestWithGroup(TestModulatedDeformableConvOp): class TestWithGroup(TestModulatedDeformableConvOp):
def init_test_case(self):
self.pad = [1, 1]
self.stride = [1, 1]
self.dilations = [1, 1]
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]
self.im2col_step = 1
self.deformable_groups = 1
offset_c = 2 * self.deformable_groups * self.filter_size[
2] * self.filter_size[3]
self.offset_size = [
self.input_size[0], offset_c, self.input_size[2], self.input_size[3]
]
def init_group(self): def init_group(self):
self.groups = 2 self.groups = 2
......
...@@ -377,7 +377,7 @@ class TestNearestInterpOp_attr_tensor(OpTest): ...@@ -377,7 +377,7 @@ class TestNearestInterpOp_attr_tensor(OpTest):
def init_test_case(self): def init_test_case(self):
self.interp_method = 'nearest' self.interp_method = 'nearest'
self.input_shape = [2, 3, 4, 4] self.input_shape = [2, 5, 4, 4]
self.out_h = 3 self.out_h = 3
self.out_w = 3 self.out_w = 3
self.scale = 0. self.scale = 0.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册