Skip to content

Commit

Permalink
[CPU] NMS test for the rest of 1st & 2nd outputs. (openvinotoolkit#3351)
Browse files Browse the repository at this point in the history
  • Loading branch information
nshchego authored and evolosen committed Dec 3, 2020
1 parent da7f54c commit bab8f66
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,9 @@ class NonMaxSuppressionImpl: public ExtLayerBase {
}
}
std::fill(selectedIndicesPtr, selectedIndicesPtr + (selectedBoxesNum - idx) * selectedIndicesStride, -1);
if (outputs.size() > NMS_SELECTEDSCORES) {
std::fill(selectedScoresPtr, selectedScoresPtr + (selectedBoxesNum - idx) * selectedIndicesStride, -1.f);
}
if (outputs.size() > NMS_VALIDOUTPUTS)
*valid_outputs = static_cast<int>(validOutputs);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,22 @@ void NmsLayerTest::Compare(const std::vector<std::vector<std::uint8_t>> &expecte
const auto &precision = actual->getTensorDesc().getPrecision();
size_t size = expected.size() / actual->getTensorDesc().getPrecision().size();
switch (precision) {
case Precision::FP32:
case Precision::FP32: {
LayerTestsCommon::Compare(reinterpret_cast<const float *>(expectedBuffer), reinterpret_cast<const float *>(actualBuffer), size, threshold);
const auto fBuffer = lockedMemory.as<const float *>();
for (int i = size; i < actual->size(); i++) {
ASSERT_TRUE(fBuffer[i] == -1.f) << "Invalid default value: " << fBuffer[i] << " at index: " << i;
}
break;
case Precision::I32:
}
case Precision::I32: {
LayerTestsCommon::Compare(reinterpret_cast<const int32_t *>(expectedBuffer), reinterpret_cast<const int32_t *>(actualBuffer), size, 0);
const auto iBuffer = lockedMemory.as<const int *>();
for (int i = size; i < actual->size(); i++) {
ASSERT_TRUE(iBuffer[i] == -1) << "Invalid default value: " << iBuffer[i] << " at index: " << i;
}
break;
}
default:
FAIL() << "Comparator for " << precision << " precision isn't supported";
}
Expand Down

0 comments on commit bab8f66

Please sign in to comment.