From fa33262d2e43adc1f4fe559caeba706c5f0df4bc Mon Sep 17 00:00:00 2001 From: xuwei06 Date: Wed, 14 Dec 2016 13:36:18 -0800 Subject: [PATCH] Check the input size for convolution. Make sure the input size is correct. Change-Id: I2559075e32a098c5ed51942ff8351d964a6d6c75 --- paddle/gserver/layers/ConvProjection.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/paddle/gserver/layers/ConvProjection.cpp b/paddle/gserver/layers/ConvProjection.cpp index aa634b3287d..57d2d83590d 100644 --- a/paddle/gserver/layers/ConvProjection.cpp +++ b/paddle/gserver/layers/ConvProjection.cpp @@ -130,6 +130,12 @@ void ConvProjection::reshapeTensorDesc(int batchSize) { void ConvProjection::reshape(int batchSize) { size_t width = calOutputSize(); CHECK_EQ(width, out_->value->getWidth()); + CHECK_EQ(channels_ * imageH_ * imageW_, in_->value->getWidth()) + << "Wrong input size for convolution" + << " channels=" << channels_ + << " imageH=" << imageH_ + << " imageW=" << imageW_ + << " inputSize=" << in_->value->getWidth(); isSelectAlgo_ = (batchSize == batchNum_); batchNum_ = batchSize; -- GitLab