提交 d528ffaa 编写于 作者: Z zhupengyang 提交者: hong19860320

use large input shape for accuracy test (#21716)

affine_grid, label_smooth, spectral_norm, warpctc,
nearest_interp, data_norm, match_matrix_tensor,
var_conv_2d, fused_embedding_seq_pool

test=develop
上级 a2175cfc
...@@ -63,8 +63,8 @@ class TestAffineGridOp(OpTest): ...@@ -63,8 +63,8 @@ class TestAffineGridOp(OpTest):
max_relative_error=0.006) max_relative_error=0.006)
def initTestCase(self): def initTestCase(self):
self.theta_shape = (3, 2, 3) self.theta_shape = (17, 2, 3)
self.output_shape = np.array([3, 2, 5, 7]).astype("int32") self.output_shape = np.array([17, 2, 5, 7]).astype("int32")
self.dynamic_shape = False self.dynamic_shape = False
......
...@@ -182,12 +182,11 @@ class TestDataNormOp(OpTest): ...@@ -182,12 +182,11 @@ class TestDataNormOp(OpTest):
self.op_type = 'data_norm' self.op_type = 'data_norm'
self.use_mkldnn = False self.use_mkldnn = False
epsilon = 0.00001 epsilon = 0.00001
x_shape = [2, 3] x_shape = [10, 12]
scale_shape = [3] scale_shape = [12]
tp = np.float32 tp = np.float32
x_val = np.array([[-0.35702616, -0.42756206, -0.08306625], x_val = np.random.random(x_shape).astype(tp)
[0.41199666, -0.21719968, -0.10180971]]).astype(tp)
batch_size = np.ones(scale_shape).astype(tp) batch_size = np.ones(scale_shape).astype(tp)
batch_size *= 1e4 batch_size *= 1e4
batch_sum = np.zeros(scale_shape).astype(tp) batch_sum = np.zeros(scale_shape).astype(tp)
...@@ -196,8 +195,8 @@ class TestDataNormOp(OpTest): ...@@ -196,8 +195,8 @@ class TestDataNormOp(OpTest):
y = np.array(x_val) y = np.array(x_val)
mean = np.array([[0, 0, 0], [0, 0, 0]]).astype(tp) mean = np.zeros(x_shape).astype(tp)
scale = np.array([[1, 1, 1], [1, 1, 1]]).astype(tp) scale = np.ones(x_shape).astype(tp)
self.inputs = { self.inputs = {
"X": x_val, "X": x_val,
......
...@@ -28,7 +28,7 @@ import paddle.version as ver ...@@ -28,7 +28,7 @@ import paddle.version as ver
class TestFusedEmbeddingSeqPoolOp(OpTest): class TestFusedEmbeddingSeqPoolOp(OpTest):
def setUp(self): def setUp(self):
self.op_type = "fused_embedding_seq_pool" self.op_type = "fused_embedding_seq_pool"
self.emb_size = 2 self.emb_size = 6
self.table = np.random.random((17, self.emb_size)).astype("float32") self.table = np.random.random((17, self.emb_size)).astype("float32")
self.ids = np.array([[[4], [3]], [[4], [3]], [[2], [1]], self.ids = np.array([[[4], [3]], [[4], [3]], [[2], [1]],
[[16], [1]]]).astype("int64") [[16], [1]]]).astype("int64")
......
...@@ -23,7 +23,7 @@ class TestLabelSmoothOp(OpTest): ...@@ -23,7 +23,7 @@ class TestLabelSmoothOp(OpTest):
def config(self): def config(self):
self.op_type = "label_smooth" self.op_type = "label_smooth"
self.epsilon = 0.1 self.epsilon = 0.1
batch_size, self.label_dim = 5, 10 batch_size, self.label_dim = 10, 12
self.label = np.zeros((batch_size, self.label_dim)).astype("float64") self.label = np.zeros((batch_size, self.label_dim)).astype("float64")
nonzero_index = np.random.randint(self.label_dim, size=(batch_size)) nonzero_index = np.random.randint(self.label_dim, size=(batch_size))
self.label[np.arange(batch_size), nonzero_index] = 1 self.label[np.arange(batch_size), nonzero_index] = 1
......
...@@ -30,7 +30,7 @@ class TestMatchMatrixTensorOp(OpTest): ...@@ -30,7 +30,7 @@ class TestMatchMatrixTensorOp(OpTest):
self.op_type = "match_matrix_tensor" self.op_type = "match_matrix_tensor"
def set_data(self): def set_data(self):
ix, iy, h, dim_t = [5, 8, 3, 4] ix, iy, h, dim_t = [5, 8, 20, 4]
x_lod = [[1, 2, 2]] x_lod = [[1, 2, 2]]
y_lod = [[3, 1, 4]] y_lod = [[3, 1, 4]]
self.init_data(ix, x_lod, iy, y_lod, h, dim_t) self.init_data(ix, x_lod, iy, y_lod, h, dim_t)
......
...@@ -121,7 +121,7 @@ class TestNearestInterpOp(OpTest): ...@@ -121,7 +121,7 @@ class TestNearestInterpOp(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, 3, 4, 5]
self.out_h = 2 self.out_h = 2
self.out_w = 2 self.out_w = 2
self.scale = 0. self.scale = 0.
......
...@@ -73,9 +73,9 @@ class TestSpectralNormOpNoGrad(OpTest): ...@@ -73,9 +73,9 @@ class TestSpectralNormOpNoGrad(OpTest):
self.check_output() self.check_output()
def initTestCase(self): def initTestCase(self):
self.weight_shape = (2, 3) self.weight_shape = (10, 12)
self.u_shape = (2, ) self.u_shape = (10, )
self.v_shape = (3, ) self.v_shape = (12, )
self.dim = 0 self.dim = 0
self.power_iters = 5 self.power_iters = 5
self.eps = 1e-12 self.eps = 1e-12
...@@ -100,9 +100,9 @@ class TestSpectralNormOp(TestSpectralNormOpNoGrad): ...@@ -100,9 +100,9 @@ class TestSpectralNormOp(TestSpectralNormOpNoGrad):
max_relative_error=0.1) max_relative_error=0.1)
def initTestCase(self): def initTestCase(self):
self.weight_shape = (2, 3) self.weight_shape = (10, 12)
self.u_shape = (2, ) self.u_shape = (10, )
self.v_shape = (3, ) self.v_shape = (12, )
self.dim = 0 self.dim = 0
self.power_iters = 0 self.power_iters = 0
self.eps = 1e-12 self.eps = 1e-12
......
...@@ -29,7 +29,7 @@ class TestVarConv2dOp(OpTest): ...@@ -29,7 +29,7 @@ class TestVarConv2dOp(OpTest):
self.op_type = "var_conv_2d" self.op_type = "var_conv_2d"
def set_data(self): def set_data(self):
input_channel = 3 input_channel = 8
output_channel = 2 output_channel = 2
filter_size = [2, 3] filter_size = [2, 3]
stride = [1, 1] stride = [1, 1]
......
...@@ -178,7 +178,7 @@ class CTCForward(object): ...@@ -178,7 +178,7 @@ class CTCForward(object):
class TestWarpCTCOp(OpTest): class TestWarpCTCOp(OpTest):
def config(self): def config(self):
self.batch_size = 4 self.batch_size = 4
self.num_classes = 8 self.num_classes = 12
self.logits_lod = [[4, 1, 3, 3]] self.logits_lod = [[4, 1, 3, 3]]
self.labels_lod = [[3, 1, 4, 4]] self.labels_lod = [[3, 1, 4, 4]]
self.blank = self.num_classes - 1 self.blank = self.num_classes - 1
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册