Skip to content

Commit bd3f976

Browse files
authored
Merge pull request #906 from emailweixu/check_cnn_input_size
Check the input size for convolution.
2 parents dd894c2 + 7462692 commit bd3f976

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

paddle/gserver/layers/ConvProjection.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,10 @@ void ConvProjection::reshapeTensorDesc(int batchSize) {
130130
void ConvProjection::reshape(int batchSize) {
131131
size_t width = calOutputSize();
132132
CHECK_EQ(width, out_->value->getWidth());
133+
CHECK_EQ(channels_ * imageH_ * imageW_, in_->value->getWidth())
134+
<< "Wrong input size for convolution"
135+
<< " channels=" << channels_ << " imageH=" << imageH_
136+
<< " imageW=" << imageW_ << " inputSize=" << in_->value->getWidth();
133137

134138
isSelectAlgo_ = (batchSize == batchNum_);
135139
batchNum_ = batchSize;

0 commit comments

Comments
 (0)