Skip to content

Commit 38e7ad7

Browse files
author
gaoyuan
committed
Set detection output to NULL
1 parent 4343be3 commit 38e7ad7

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

paddle/gserver/layers/DetectionOutputLayer.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,13 @@ void DetectionOutputLayer::forward(PassType passType) {
139139
allDecodedBBoxes,
140140
&allIndices);
141141

142-
numKept = numKept > 0 ? numKept : 1;
143-
resetOutput(numKept, 7);
142+
if (numKept > 0) {
143+
resetOutput(numKept, 7);
144+
} else {
145+
MatrixPtr outV = getOutputValue();
146+
outV = NULL;
147+
return;
148+
}
144149
MatrixPtr outV = getOutputValue();
145150
getDetectionOutput(confBuffer_->getData(),
146151
numKept,

paddle/gserver/layers/DetectionUtil.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,6 @@ void getDetectionOutput(const real* confData,
536536
MatrixPtr outBuffer;
537537
Matrix::resizeOrCreate(outBuffer, numKept, 7, false, false);
538538
real* bufferData = outBuffer->getData();
539-
for (size_t i = 0; i < 7; i++) bufferData[i] = -1;
540539
size_t count = 0;
541540
for (size_t n = 0; n < batchSize; ++n) {
542541
for (map<size_t, vector<size_t>>::const_iterator it = allIndices[n].begin();

0 commit comments

Comments
 (0)