From b7c4b58d3d041d4afe4da3d7f8b7d7366e8dce8d Mon Sep 17 00:00:00 2001 From: hedaoyuan Date: Thu, 28 Dec 2017 14:51:32 +0800 Subject: [PATCH] Follow comments. --- paddle/function/GemmConvOp.cpp | 6 ++++-- paddle/function/Im2Col.h | 2 +- paddle/function/Im2ColTest.cpp | 14 +++++++------- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/paddle/function/GemmConvOp.cpp b/paddle/function/GemmConvOp.cpp index 25cc3df667..cbdbf5335d 100644 --- a/paddle/function/GemmConvOp.cpp +++ b/paddle/function/GemmConvOp.cpp @@ -189,8 +189,8 @@ public: size_t colHeight = inputChannels / groups_ * filterHeight * filterWidth; size_t colWidth = outputHeight * outputWidth; // Max col matrix height 256, Max col matrix width 1024 - size_t stepColHeight = std::min(colHeight, (size_t)256); - size_t stepColWidth = std::min(colWidth, (size_t)2048); + size_t stepColHeight = std::min(colHeight, static_cast(256)); + size_t stepColWidth = std::min(colWidth, static_cast(2048)); if (needIm2col) { colShape = TensorShape({inputChannels / groups_, @@ -278,6 +278,8 @@ public: inputData += inputChannels * inputHeight * inputWidth; outputData += outputChannels * outputHeight * outputWidth; } + + memory_.reset(); } }; diff --git a/paddle/function/Im2Col.h b/paddle/function/Im2Col.h index 1053e4fd23..36a9bcf84e 100644 --- a/paddle/function/Im2Col.h +++ b/paddle/function/Im2Col.h @@ -136,7 +136,7 @@ public: (imRowIdx - paddingHeight) >= inputHeight || (imColIdx - paddingWidth) < 0 || (imColIdx - paddingWidth) >= inputWidth) { - colData[colh * colWidthSize + colw] = T(0); + colData[colh * colWidthSize + colw] = static_cast(0); } else { imRowIdx += c_im * inputHeight - paddingHeight; imColIdx -= paddingWidth; diff --git a/paddle/function/Im2ColTest.cpp b/paddle/function/Im2ColTest.cpp index c573469168..3ba866dcdd 100644 --- a/paddle/function/Im2ColTest.cpp +++ b/paddle/function/Im2ColTest.cpp @@ -140,13 +140,13 @@ TEST(Im2ColFunctor, GPU) { TestIm2ColFunctor(); } template void TestIm2ColMobileFunctor() { - for (size_t channels : {1, 5, 32}) { - for (size_t inputHeight : {5, 33, 100}) { - for (size_t inputWidth : {5, 32, 96}) { - for (size_t filterHeight : {1, 5}) { - for (size_t filterWidth : {3, 7}) { - for (size_t stride : {1, 2}) { - for (size_t padding : {0, 1}) { + for (size_t channels : {32}) { + for (size_t inputHeight : {33, 100}) { + for (size_t inputWidth : {32, 96}) { + for (size_t filterHeight : {5}) { + for (size_t filterWidth : {7}) { + for (size_t stride : {2}) { + for (size_t padding : {1}) { for (size_t dilation : {1, 3}) { size_t filterSizeH = (filterHeight - 1) * dilation + 1; size_t filterSizeW = (filterWidth - 1) * dilation + 1; -- GitLab