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

Method verifyOutput

samples/sampleINT8API/sampleINT8API.cpp:459–484  ·  view source on GitHub ↗

\brief Verifies that the output is correct and prints it

Source from the content-addressed store, hash-verified

457//! \brief Verifies that the output is correct and prints it
458//!
459bool 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

Callers

nothing calls this directly

Calls 4

argMagnitudeSortFunction · 0.85
readReferenceFileFunction · 0.85
classifyFunction · 0.85
getHostBufferMethod · 0.45

Tested by

no test coverage detected