original code:
if (padh || padw) {
// If we have padding, ensure that the last pooling starts strictly
// inside the image (instead of at the padding); otherwise clip the last.`
if ((pooledheight - 1) strideh >= height_ + padh) {
--pooledheight;
}
if ((pooledwidth - 1) stridew >= width_ + padw) {
--pooledwidth;
}
CHECK_LT((pooledheight - 1) strideh, height_ + padh);
CHECK_LT((pooledwidth - 1) stridew, width_ + padw);
}
I think that “if (padh || padw) ” should be removed!
For example:
Input feature map = hiwi= 66,kernel=1,stride=2,pad=0,round_mode=CEIL;
ho=ceil_div((6+20-1) ,2)+1=4
(ho-1)stride=(4-1)*2=6=hi+pad=6+0
In this case, the 4th output point is out side of the input map, ho/wo must be decreased by 1!
Issue summary A bug in pooling_layer.cpp?
original code: if (padh || padw) { // If we have padding, ensure that the last pooling starts strictly // inside the image (instead of at the padding); otherwise clip the last.` if ((pooledheight - 1) strideh >= height_ + padh) { --pooledheight; } if ((pooledwidth - 1) stridew >= width_ + padw) { --pooledwidth; } CHECK_LT((pooledheight - 1) strideh, height_ + padh); CHECK_LT((pooledwidth - 1) stridew, width_ + padw); } I think that “if (padh || padw) ” should be removed!
For example: Input feature map = hiwi= 66,kernel=1,stride=2,pad=0,round_mode=CEIL; ho=ceil_div((6+20-1) ,2)+1=4 (ho-1)stride=(4-1)*2=6=hi+pad=6+0 In this case, the 4th output point is out side of the input map, ho/wo must be decreased by 1!
So, “if (padh || padw) ” should be removed!