aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorA. Unique TensorFlower <gardener@tensorflow.org>2021-02-17 19:32:12 -0800
committerTensorFlower Gardener <gardener@tensorflow.org>2021-02-17 19:38:05 -0800
commit72e1ddc7635e3605a9f54831e2316a3a48c7c106 (patch)
tree6aade5e2896e479324c9efdca09f538ffe224139
parent630a18b20f90b34c73768feed67176b48ec9c254 (diff)
downloadtensorflow-72e1ddc7635e3605a9f54831e2316a3a48c7c106.tar.gz
Internal change
PiperOrigin-RevId: 358086483 Change-Id: I3226271fc2065713cdf59ae14110db8d738a8a99
-rw-r--r--tensorflow/lite/kernels/detection_postprocess.cc14
1 files changed, 2 insertions, 12 deletions
diff --git a/tensorflow/lite/kernels/detection_postprocess.cc b/tensorflow/lite/kernels/detection_postprocess.cc
index 783e781bfce..d5c3aa982c5 100644
--- a/tensorflow/lite/kernels/detection_postprocess.cc
+++ b/tensorflow/lite/kernels/detection_postprocess.cc
@@ -367,16 +367,6 @@ void DecreasingPartialArgSort(const float* values, int num_values,
[&values](const int i, const int j) { return values[i] > values[j]; });
}
-void DecreasingArgSort(const float* values, int num_values, int* indices) {
- std::iota(indices, indices + num_values, 0);
-
- // We want here a stable sort, in order to get completely defined output.
- // In this way TFL and TFLM can be bit-exact.
- std::stable_sort(
- indices, indices + num_values,
- [&values](const int i, const int j) { return values[i] > values[j]; });
-}
-
void SelectDetectionsAboveScoreThreshold(const std::vector<float>& values,
const float threshold,
std::vector<float>* keep_values,
@@ -461,8 +451,8 @@ TfLiteStatus NonMaxSuppressionSingleClassHelper(
int num_scores_kept = keep_scores.size();
std::vector<int> sorted_indices;
sorted_indices.resize(num_scores_kept);
- DecreasingArgSort(keep_scores.data(), num_scores_kept, sorted_indices.data());
-
+ DecreasingPartialArgSort(keep_scores.data(), num_scores_kept, num_scores_kept,
+ sorted_indices.data());
const int num_boxes_kept = num_scores_kept;
const int output_size = std::min(num_boxes_kept, max_detections);
selected->clear();