\brief Verifies that the output is correct and prints it
| 457 | //! \brief Verifies that the output is correct and prints it |
| 458 | //! |
| 459 | bool SampleINT8API::verifyOutput(const samplesCommon::BufferManager& buffers) const |
| 460 | { |
| 461 | // copy output host buffer data for further processing |
| 462 | const float* probPtr = static_cast<const float*>(buffers.getHostBuffer(mInOut.at("output"))); |
| 463 | std::vector<float> output(probPtr, probPtr + mOutputDims.d[1]); |
| 464 | |
| 465 | auto inds = samplesCommon::argMagnitudeSort(output.cbegin(), output.cend()); |
| 466 | |
| 467 | // read reference lables to generate prediction lables |
| 468 | std::vector<std::string> referenceVector; |
| 469 | if (!samplesCommon::readReferenceFile(mParams.referenceFileName, referenceVector)) |
| 470 | { |
| 471 | sample::gLogError << "Unable to read reference file: " << mParams.referenceFileName << std::endl; |
| 472 | return false; |
| 473 | } |
| 474 | |
| 475 | std::vector<std::string> top5Result = samplesCommon::classify(referenceVector, output, 5); |
| 476 | |
| 477 | sample::gLogInfo << "SampleINT8API result: Detected:" << std::endl; |
| 478 | for (int i = 1; i <= 5; ++i) |
| 479 | { |
| 480 | sample::gLogInfo << "[" << i << "] " << top5Result[i - 1] << std::endl; |
| 481 | } |
| 482 | |
| 483 | return true; |
| 484 | } |
| 485 | |
| 486 | //! |
| 487 | //! \brief Creates the network, configures the builder and creates the network engine |
nothing calls this directly
no test coverage detected