Skip to content

Commit 06ea2bf

Browse files
authored
Merge pull request #967 from pengli09/fix_test_type
change float to real in two tests
2 parents 37f7595 + 67fcd89 commit 06ea2bf

File tree

2 files changed

+12
-29
lines changed

2 files changed

+12
-29
lines changed

paddle/gserver/tests/test_ConvTrans.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,8 @@ TEST(Layer, convTransLayerFwd2) {
206206
/* filter_size */ 5,
207207
result);
208208

209-
float resultData[] = {1, 2, 2, 2, 1, 2, 4, 4, 4, 2, 2, 4, 4,
210-
4, 2, 2, 4, 4, 4, 2, 1, 2, 2, 2, 1};
209+
real resultData[] = {1, 2, 2, 2, 1, 2, 4, 4, 4, 2, 2, 4, 4,
210+
4, 2, 2, 4, 4, 4, 2, 1, 2, 2, 2, 1};
211211
result->setData(resultData);
212212
doOneConvtTest(/* imgSize */ 5,
213213
/* output_x */ 2,
@@ -216,8 +216,8 @@ TEST(Layer, convTransLayerFwd2) {
216216
/* filter_size */ 4,
217217
result);
218218

219-
float resultData2[] = {1, 2, 2, 2, 1, 2, 4, 4, 4, 2, 2, 4, 4,
220-
4, 2, 2, 4, 4, 4, 2, 1, 2, 2, 2, 1};
219+
real resultData2[] = {1, 2, 2, 2, 1, 2, 4, 4, 4, 2, 2, 4, 4,
220+
4, 2, 2, 4, 4, 4, 2, 1, 2, 2, 2, 1};
221221
result->setData(resultData2);
222222
doOneConvtTest(/* imgSize */ 5,
223223
/* output_x */ 2,
@@ -226,8 +226,8 @@ TEST(Layer, convTransLayerFwd2) {
226226
/* filter_size */ 5,
227227
result);
228228

229-
float resultData3[] = {1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 2, 2, 4,
230-
2, 2, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1};
229+
real resultData3[] = {1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 2, 2, 4,
230+
2, 2, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1};
231231
result->setData(resultData3);
232232
doOneConvtTest(/* imgSize */ 5,
233233
/* output_x */ 2,

paddle/gserver/tests/test_ConvUnify.cpp

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ TEST(Layer, convParaUnified) {
106106
#ifndef PADDLE_ONLY_CPU
107107
MatrixPtr input, resultCpu, resultGpu;
108108
input = Matrix::create(1, 4 * 4, false, false);
109-
float inputData[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16};
110-
float param[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 9, 8, 7, 6, 5, 4, 3, 2, 1};
109+
real inputData[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16};
110+
real param[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 9, 8, 7, 6, 5, 4, 3, 2, 1};
111111

112112
input->setData(inputData);
113113

@@ -137,26 +137,9 @@ TEST(Layer, convParaUnified) {
137137
checkMatrixEqual(resultCpu, resultGpu);
138138

139139
input = Matrix::create(1, 3 * 3 * 2, false, false);
140-
float inputData2[] = {1,
141-
2,
142-
3,
143-
4,
144-
5,
145-
6,
146-
7,
147-
8,
148-
9,
149-
150-
10,
151-
11,
152-
12,
153-
13,
154-
14,
155-
15,
156-
16,
157-
17,
158-
18};
159-
float param2[] = {1, 2, 3, 4, 5, 6, 7, 8, 8, 7, 6, 5, 4, 3, 2, 1};
140+
real inputData2[] = {
141+
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18};
142+
real param2[] = {1, 2, 3, 4, 5, 6, 7, 8, 8, 7, 6, 5, 4, 3, 2, 1};
160143

161144
input->setData(inputData2);
162145

@@ -185,7 +168,7 @@ TEST(Layer, convParaUnified) {
185168
true);
186169
checkMatrixEqual(resultCpu, resultGpu);
187170

188-
float param3[] = {1, 2, 3, 4, 4, 3, 2, 1};
171+
real param3[] = {1, 2, 3, 4, 4, 3, 2, 1};
189172

190173
resultCpu = doOneConvTest(/* imgSize */ 3,
191174
/* output_x */ 2,

0 commit comments

Comments
 (0)