Skip to content

Commit 54b3994

Browse files
authored
Merge pull request #5919 from qingqing01/roi_pooling
Fix bug in RoI pooling.
2 parents a06bec1 + a21fe4a commit 54b3994

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

paddle/gserver/layers/ROIPoolLayer.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ See the License for the specific language governing permissions and
1313
limitations under the License. */
1414

1515
#include "ROIPoolLayer.h"
16+
#include <cfloat>
1617

1718
namespace paddle {
1819

@@ -126,10 +127,8 @@ void ROIPoolLayer::forward(PassType passType) {
126127

127128
bool isEmpty = (hend <= hstart) || (wend <= wstart);
128129
size_t poolIndex = ph * pooledWidth_ + pw;
129-
if (isEmpty) {
130-
outputData[poolIndex] = 0;
131-
argmaxData[poolIndex] = -1;
132-
}
130+
outputData[poolIndex] = isEmpty ? 0 : -FLT_MAX;
131+
argmaxData[poolIndex] = -1;
133132

134133
for (size_t h = hstart; h < hend; ++h) {
135134
for (size_t w = wstart; w < wend; ++w) {

0 commit comments

Comments
 (0)