MCPcopy Create free account
hub / github.com/NVIDIA/TensorRT / classify

Function classify

samples/common/common.h:427–438  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

425
426template <typename T>
427std::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.
441template <typename T>

Callers 1

verifyOutputMethod · 0.85

Calls 1

argMagnitudeSortFunction · 0.85

Tested by

no test coverage detected