|
|
|
@ -79,10 +79,12 @@ void TopK(const std::vector<T>& data,
|
|
|
|
|
int cur = values->size() - 1;
|
|
|
|
|
while (!pq.empty()) {
|
|
|
|
|
const auto& item = pq.top();
|
|
|
|
|
pq.pop();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(*values)[cur] = item.first;
|
|
|
|
|
(*indices)[cur] = item.second;
|
|
|
|
|
|
|
|
|
|
// item if reference, must pop here
|
|
|
|
|
pq.pop();
|
|
|
|
|
|
|
|
|
|
cur--;
|
|
|
|
|
}
|
|
|
|
@ -93,4 +95,4 @@ template void TopK<float>(const std::vector<float>& data,
|
|
|
|
|
std::vector<float>* values,
|
|
|
|
|
std::vector<int>* indices);
|
|
|
|
|
|
|
|
|
|
} // namespace ppspeech
|
|
|
|
|
} // namespace ppspeech
|
|
|
|
|