Skip to content

Commit cc9a761

Browse files
committed
Fix bug in RoI pooling.
1 parent 1f6002e commit cc9a761

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

paddle/gserver/layers/ROIPoolLayer.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,8 @@ void ROIPoolLayer::forward(PassType passType) {
126126

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

134132
for (size_t h = hstart; h < hend; ++h) {
135133
for (size_t w = wstart; w < wend; ++w) {

0 commit comments

Comments
 (0)