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

Method validateOutput

samples/sampleDynamicReshape/sampleDynamicReshape.cpp:461–478  ·  view source on GitHub ↗

\brief Checks whether the model prediction (in mOutput) is correct.

Source from the content-addressed store, hash-verified

459//! \brief Checks whether the model prediction (in mOutput) is correct.
460//!
461bool SampleDynamicReshape::validateOutput(int digit)
462{
463 const float* bufRaw = static_cast<const float*>(mOutput.hostBuffer.data());
464 std::vector<float> prob(bufRaw, bufRaw + mOutput.hostBuffer.size());
465
466 int curIndex{0};
467 for (const auto& elem : prob)
468 {
469 sample::gLogInfo << " Prob " << curIndex << " " << std::fixed << std::setw(5) << std::setprecision(4) << elem
470 << " "
471 << "Class " << curIndex << ": " << std::string(int(std::floor(elem * 10 + 0.5F)), '*')
472 << std::endl;
473 ++curIndex;
474 }
475
476 int predictedDigit = std::max_element(prob.begin(), prob.end()) - prob.begin();
477 return digit == predictedDigit;
478}
479
480//!
481//! \brief Initializes members of the params struct using the command line args

Callers

nothing calls this directly

Calls 3

floorFunction · 0.50
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected