From c70d3e1af85f960555fcdcd5341453e277c326ec Mon Sep 17 00:00:00 2001 From: hedaoyuan Date: Fri, 2 Jun 2017 18:17:20 +0800 Subject: [PATCH] Some bug fix --- paddle/function/GemmConvOp.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/paddle/function/GemmConvOp.cpp b/paddle/function/GemmConvOp.cpp index 6857fe7482..e7a93ae676 100644 --- a/paddle/function/GemmConvOp.cpp +++ b/paddle/function/GemmConvOp.cpp @@ -96,7 +96,7 @@ public: size_t inputHeight = inputs[0].shape()[2]; size_t inputWidth = inputs[0].shape()[3]; size_t filterHeight = inputs[1].shape()[2]; - size_t filterWidth = inputs[1].shape()[2]; + size_t filterWidth = inputs[1].shape()[3]; size_t outputChannels = outputs[0].shape()[1]; size_t outputHeight = outputs[0].shape()[2]; size_t outputWidth = outputs[0].shape()[3]; @@ -148,23 +148,29 @@ public: 0.0f, outputData + g * outputOffset, N); - inputData += inputChannels * inputHeight * inputWidth; - outputData += outputChannels * outputHeight * outputWidth; } + inputData += inputChannels * inputHeight * inputWidth; + outputData += outputChannels * outputHeight * outputWidth; } } void resizeBuffer(size_t newSize) { if (!memory_ || newSize * sizeof(real) > memory_->getAllocSize()) { - memory_ = std::make_shared(newSize * sizeof(real)); + if (Device == DEVICE_TYPE_CPU) { + memory_ = std::make_shared(newSize * sizeof(real)); + } else { + memory_ = std::make_shared(newSize * sizeof(real)); + } } } private: - CpuMemHandlePtr memory_; + MemoryHandlePtr memory_; }; REGISTER_TYPED_FUNC(GemmConv, CPU, GemmConvFunction); +#ifndef PADDLE_ONLY_CPU REGISTER_TYPED_FUNC(GemmConv, GPU, GemmConvFunction); +#endif } // namespace paddle -- GitLab