BVLC / caffe

Caffe: a fast open framework for deep learning.
http://caffe.berkeleyvision.org/
Other
33.98k stars 18.72k forks source link

A bug in pooling_layer.cpp? #6942

Open lvjunsetup opened 4 years ago

lvjunsetup commented 4 years ago

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!