提交 0b9c4cd7 编写于 作者: X xzl

fix comments

上级 5aa3e768
...@@ -51,8 +51,8 @@ __global__ void KeMaxPoolForward(const int nthreads, ...@@ -51,8 +51,8 @@ __global__ void KeMaxPoolForward(const int nthreads,
for (int h = hstart; h < hend; ++h) { for (int h = hstart; h < hend; ++h) {
for (int w = wstart; w < wend; ++w) { for (int w = wstart; w < wend; ++w) {
if (maxval < inputData[h * width + w]) { if (maxval < inputData[h * width + w]) {
maxval = inputData[h * width + w];
max_index = h * width + w; max_index = h * width + w;
maxval = inputData[max_index];
} }
} }
} }
......
...@@ -105,8 +105,7 @@ TEST(Layer, maxPoolingWithMaskOutputLayerFwd) { ...@@ -105,8 +105,7 @@ TEST(Layer, maxPoolingWithMaskOutputLayerFwd) {
maskMat->setData(maskData); maskMat->setData(maskData);
doOneMaxPoolingWithMaskOutputTest( doOneMaxPoolingWithMaskOutputTest(
inputMat, "max-pool-with-mask", useGpu, maskMat); inputMat, "max-pool-with-mask", useGpu, maskMat);
/* #ifdef PADDLE_WITH_CUDA
#ifdef PADDLE_WITH_CUDA
useGpu = true; useGpu = true;
inputMat = Matrix::create(1, 25, false, useGpu); inputMat = Matrix::create(1, 25, false, useGpu);
maskMat = Matrix::create(1, 4, false, useGpu); maskMat = Matrix::create(1, 4, false, useGpu);
...@@ -114,6 +113,5 @@ TEST(Layer, maxPoolingWithMaskOutputLayerFwd) { ...@@ -114,6 +113,5 @@ TEST(Layer, maxPoolingWithMaskOutputLayerFwd) {
maskMat->copyFrom(maskData, 4); maskMat->copyFrom(maskData, 4);
doOneMaxPoolingWithMaskOutputTest( doOneMaxPoolingWithMaskOutputTest(
inputMat, "max-pool-with-mask", useGpu, maskMat); inputMat, "max-pool-with-mask", useGpu, maskMat);
#endif #endif
*/
} }
...@@ -2021,7 +2021,7 @@ void CpuMatrix::maxPoolForward(Matrix& inputMat, ...@@ -2021,7 +2021,7 @@ void CpuMatrix::maxPoolForward(Matrix& inputMat,
int wstart = pw * strideW - paddingW; int wstart = pw * strideW - paddingW;
int wend = std::min(wstart + sizeX, imgSizeW); int wend = std::min(wstart + sizeX, imgSizeW);
wstart = std::max(wstart, 0); wstart = std::max(wstart, 0);
if (maskMatP == NULL) { if (maskData == NULL) {
for (int h = hstart; h < hend; ++h) { for (int h = hstart; h < hend; ++h) {
for (int w = wstart; w < wend; ++w) { for (int w = wstart; w < wend; ++w) {
outData[ph * outputW + pw] = std::max( outData[ph * outputW + pw] = std::max(
...@@ -2044,7 +2044,7 @@ void CpuMatrix::maxPoolForward(Matrix& inputMat, ...@@ -2044,7 +2044,7 @@ void CpuMatrix::maxPoolForward(Matrix& inputMat,
inputData += inLength; inputData += inLength;
outData += outLength; outData += outLength;
if (maskMatP != NULL) maskData += outLength; if (maskData != NULL) maskData += outLength;
} }
} }
} }
......
...@@ -2701,7 +2701,7 @@ def img_pool_layer(input, ...@@ -2701,7 +2701,7 @@ def img_pool_layer(input,
assert type(pool_type) in [AvgPooling, MaxPooling, MaxWithMaskPooling, CudnnAvgPooling, assert type(pool_type) in [AvgPooling, MaxPooling, MaxWithMaskPooling, CudnnAvgPooling,
CudnnMaxPooling], \ CudnnMaxPooling], \
"only (Cudnn)AvgPooling, (Cudnn)MaxPooling MaxWithMaskPooling are supported" "only (Cudnn)AvgPooling, (Cudnn)MaxPooling, MaxWithMaskPooling are supported"
type_name = pool_type.name + '-projection' \ type_name = pool_type.name + '-projection' \
if ( if (
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册