diff --git a/paddle/function/GemmConvOp.cpp b/paddle/function/GemmConvOp.cpp index 25cc3df6672d4f08383266e602bebd009e422bac..cbdbf5335d32d55a0221728758025c9d2cb3e7d1 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 1053e4fd232b8803c9661ece823da88715ffc220..36a9bcf84e4b14965c83627821b71d1c7c0da1b2 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 c573469168d3c18cfc574570c0681beb60a52693..3ba866dcdd845403d52f7a85adfef08cbb11c305 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;