Skip to content

Commit d050360

Browse files
authored
"reduce test input data size to accelerate ci" (#10831)
1 parent 53a509d commit d050360

File tree

1 file changed

+23
-18
lines changed

1 file changed

+23
-18
lines changed

python/paddle/fluid/tests/unittests/test_mul_op.py

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ class TestMulOp(OpTest):
2222
def setUp(self):
2323
self.op_type = "mul"
2424
self.inputs = {
25-
'X': np.random.random((32, 84)).astype("float32"),
26-
'Y': np.random.random((84, 100)).astype("float32")
25+
'X': np.random.random((2, 5)).astype("float32"),
26+
'Y': np.random.random((5, 3)).astype("float32")
2727
}
2828
self.outputs = {'Out': np.dot(self.inputs['X'], self.inputs['Y'])}
2929

@@ -46,13 +46,16 @@ class TestMulOp2(OpTest):
4646
def setUp(self):
4747
self.op_type = "mul"
4848
self.inputs = {
49-
'X': np.random.random((15, 4, 12, 10)).astype("float32"),
50-
'Y': np.random.random((4, 30, 8, 2, 9)).astype("float32")
49+
'X': np.random.random((3, 4, 4, 3)).astype("float32"),
50+
'Y': np.random.random((2, 6, 1, 2, 3)).astype("float32")
5151
}
52-
self.attrs = {'x_num_col_dims': 2, 'y_num_col_dims': 2}
53-
result = np.dot(self.inputs['X'].reshape(15 * 4, 12 * 10),
54-
self.inputs['Y'].reshape(4 * 30, 8 * 2 * 9))
55-
result = result.reshape(15, 4, 8, 2, 9)
52+
self.attrs = {
53+
'x_num_col_dims': 2,
54+
'y_num_col_dims': 2,
55+
}
56+
result = np.dot(self.inputs['X'].reshape(3 * 4, 4 * 3),
57+
self.inputs['Y'].reshape(2 * 6, 1 * 2 * 3))
58+
result = result.reshape(3, 4, 1, 2, 3)
5659
self.outputs = {'Out': result}
5760

5861
def test_check_output(self):
@@ -73,9 +76,9 @@ def test_check_grad_ignore_y(self):
7376
class TestFP16MulOp1(OpTest):
7477
def setUp(self):
7578
self.op_type = "mul"
76-
x = np.random.random((32, 84)).astype("float16")
77-
y = np.random.random((84, 100)).astype("float16")
78-
self.inputs = {'X': x.view(np.uint16), 'Y': y.view(np.uint16)}
79+
x = np.random.random((3, 5)).astype("float16")
80+
y = np.random.random((5, 4)).astype("float16")
81+
self.inputs = {'X': x.view(np.float16), 'Y': y.view(np.float16)}
7982
self.outputs = {'Out': np.dot(x, y)}
8083

8184
def test_check_output(self):
@@ -88,13 +91,15 @@ def test_check_output(self):
8891
class TestFP16MulOp2(OpTest):
8992
def setUp(self):
9093
self.op_type = "mul"
91-
x = np.random.random((15, 4, 12, 10)).astype("float16")
92-
y = np.random.random((4, 30, 8, 2, 9)).astype("float16")
93-
self.inputs = {'X': x.view(np.uint16), 'Y': y.view(np.uint16)}
94-
self.attrs = {'x_num_col_dims': 2, 'y_num_col_dims': 2}
95-
result = np.dot(
96-
x.reshape(15 * 4, 12 * 10), y.reshape(4 * 30, 8 * 2 * 9))
97-
result = result.reshape(15, 4, 8, 2, 9)
94+
x = np.random.random((3, 4, 4, 3)).astype("float16")
95+
y = np.random.random((2, 6, 1, 2, 3)).astype("float16")
96+
self.inputs = {'X': x.view(np.float16), 'Y': y.view(np.float16)}
97+
self.attrs = {
98+
'x_num_col_dims': 2,
99+
'y_num_col_dims': 2,
100+
}
101+
result = np.dot(x.reshape(3 * 4, 4 * 3), y.reshape(2 * 6, 1 * 2 * 3))
102+
result = result.reshape(3, 4, 1, 2, 3)
98103
self.outputs = {'Out': result}
99104

100105
def test_check_output(self):

0 commit comments

Comments
 (0)