| 425 | |
| 426 | template <typename T> |
| 427 | std::vector<std::string> classify( |
| 428 | const std::vector<std::string>& refVector, const std::vector<T>& output, const size_t topK) |
| 429 | { |
| 430 | const auto inds = samplesCommon::argMagnitudeSort(output.cbegin(), output.cend()); |
| 431 | std::vector<std::string> result; |
| 432 | result.reserve(topK); |
| 433 | for (size_t k = 0; k < topK; ++k) |
| 434 | { |
| 435 | result.push_back(refVector[inds[k]]); |
| 436 | } |
| 437 | return result; |
| 438 | } |
| 439 | |
| 440 | // Returns indices of highest K magnitudes in v. |
| 441 | template <typename T> |
no test coverage detected