Skip to content

Commit 0b9c4cd

Browse files
committed
fix comments
1 parent 5aa3e76 commit 0b9c4cd

File tree

4 files changed

+13
-15
lines changed

4 files changed

+13
-15
lines changed

paddle/cuda/src/hl_cuda_cnn.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ __global__ void KeMaxPoolForward(const int nthreads,
5151
for (int h = hstart; h < hend; ++h) {
5252
for (int w = wstart; w < wend; ++w) {
5353
if (maxval < inputData[h * width + w]) {
54-
maxval = inputData[h * width + w];
5554
max_index = h * width + w;
55+
maxval = inputData[max_index];
5656
}
5757
}
5858
}

paddle/gserver/tests/test_MaxPoolingWithMaskOutput.cpp

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -105,15 +105,13 @@ TEST(Layer, maxPoolingWithMaskOutputLayerFwd) {
105105
maskMat->setData(maskData);
106106
doOneMaxPoolingWithMaskOutputTest(
107107
inputMat, "max-pool-with-mask", useGpu, maskMat);
108-
/*
109-
#ifdef PADDLE_WITH_CUDA
110-
useGpu = true;
111-
inputMat = Matrix::create(1, 25, false, useGpu);
112-
maskMat = Matrix::create(1, 4, false, useGpu);
113-
inputMat->copyFrom(inputData, 25);
114-
maskMat->copyFrom(maskData, 4);
115-
doOneMaxPoolingWithMaskOutputTest(
116-
inputMat, "max-pool-with-mask", useGpu, maskMat);
117-
#endif
118-
*/
108+
#ifdef PADDLE_WITH_CUDA
109+
useGpu = true;
110+
inputMat = Matrix::create(1, 25, false, useGpu);
111+
maskMat = Matrix::create(1, 4, false, useGpu);
112+
inputMat->copyFrom(inputData, 25);
113+
maskMat->copyFrom(maskData, 4);
114+
doOneMaxPoolingWithMaskOutputTest(
115+
inputMat, "max-pool-with-mask", useGpu, maskMat);
116+
#endif
119117
}

paddle/math/Matrix.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2021,7 +2021,7 @@ void CpuMatrix::maxPoolForward(Matrix& inputMat,
20212021
int wstart = pw * strideW - paddingW;
20222022
int wend = std::min(wstart + sizeX, imgSizeW);
20232023
wstart = std::max(wstart, 0);
2024-
if (maskMatP == NULL) {
2024+
if (maskData == NULL) {
20252025
for (int h = hstart; h < hend; ++h) {
20262026
for (int w = wstart; w < wend; ++w) {
20272027
outData[ph * outputW + pw] = std::max(
@@ -2044,7 +2044,7 @@ void CpuMatrix::maxPoolForward(Matrix& inputMat,
20442044
inputData += inLength;
20452045
outData += outLength;
20462046

2047-
if (maskMatP != NULL) maskData += outLength;
2047+
if (maskData != NULL) maskData += outLength;
20482048
}
20492049
}
20502050
}

python/paddle/trainer_config_helpers/layers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2701,7 +2701,7 @@ def img_pool_layer(input,
27012701

27022702
assert type(pool_type) in [AvgPooling, MaxPooling, MaxWithMaskPooling, CudnnAvgPooling,
27032703
CudnnMaxPooling], \
2704-
"only (Cudnn)AvgPooling, (Cudnn)MaxPooling MaxWithMaskPooling are supported"
2704+
"only (Cudnn)AvgPooling, (Cudnn)MaxPooling, MaxWithMaskPooling are supported"
27052705

27062706
type_name = pool_type.name + '-projection' \
27072707
if (

0 commit comments

Comments
 (0)