From 1628fb7cda883012300456e80148b1452b5ac6a7 Mon Sep 17 00:00:00 2001 From: Liu Yiqun Date: Thu, 6 Apr 2017 11:17:07 +0800 Subject: [PATCH] Add the check of image size in exconv. --- paddle/gserver/layers/ExpandConvBaseLayer.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/paddle/gserver/layers/ExpandConvBaseLayer.cpp b/paddle/gserver/layers/ExpandConvBaseLayer.cpp index 9ddccc2027..fdcf994cdb 100644 --- a/paddle/gserver/layers/ExpandConvBaseLayer.cpp +++ b/paddle/gserver/layers/ExpandConvBaseLayer.cpp @@ -107,6 +107,10 @@ void ExpandConvBaseLayer::expandOneFrame(MatrixPtr image, int channel = isDeconv_ ? numFilters_ : channels_[inIdx]; resetExpandInput(subK_[inIdx] * groups_[inIdx], subN_[inIdx]); + + CHECK_EQ(image->getWidth(), + static_cast(imgSizeH_[inIdx] * imgSizeW_[inIdx] * channel)); + real *imgData = image->getData() + startIdx * image->getWidth(); MatrixPtr imageTmp = Matrix::create(imgData, -- GitLab