The SampleUffMNIST class implements the UffMNIST sample. More...
Public Member Functions | |
SampleUffMNIST (const samplesCommon::UffSampleParams ¶ms) | |
bool | build () |
Builds the network engine. More... | |
bool | infer () |
Runs the TensorRT inference engine for this sample. More... | |
bool | teardown () |
Used to clean up any state created in the sample class. More... | |
Private Types | |
template<typename T > | |
using | SampleUniquePtr = std::unique_ptr< T, samplesCommon::InferDeleter > |
Private Member Functions | |
void | constructNetwork (SampleUniquePtr< nvuffparser::IUffParser > &parser, SampleUniquePtr< nvinfer1::INetworkDefinition > &network) |
Parses a Uff model for MNIST and creates a TensorRT network. More... | |
bool | processInput (const samplesCommon::BufferManager &buffers, const std::string &inputTensorName, int inputFileIdx) const |
Reads the input and mean data, preprocesses, and stores the result in a managed buffer. More... | |
bool | verifyOutput (const samplesCommon::BufferManager &buffers, const std::string &outputTensorName, int groundTruthDigit) const |
Verifies that the output is correct and prints it. More... | |
Private Attributes | |
std::shared_ptr< nvinfer1::ICudaEngine > | mEngine {nullptr} |
The TensorRT engine used to run the network. More... | |
samplesCommon::UffSampleParams | mParams |
nvinfer1::Dims | mInputDims |
const int | kDIGITS {10} |
The SampleUffMNIST class implements the UffMNIST sample.
It creates the network using a Uff model
|
private |
|
inline |
bool SampleUffMNIST::build | ( | ) |
Builds the network engine.
Creates the network, configures the builder and creates the network engine.
This function creates the MNIST network by parsing the Uff model and builds the engine that will be used to run MNIST (mEngine)
bool SampleUffMNIST::infer | ( | ) |
Runs the TensorRT inference engine for this sample.
This function is the main execution function of the sample. It allocates the buffer, sets inputs, executes the engine, and verifies the output.
bool SampleUffMNIST::teardown | ( | ) |
Used to clean up any state created in the sample class.
|
private |
Parses a Uff model for MNIST and creates a TensorRT network.
Uses a Uff parser to create the MNIST Network and marks the output layers.
network | Pointer to the network that will be populated with the MNIST network |
builder | Pointer to the engine builder |
|
private |
Reads the input and mean data, preprocesses, and stores the result in a managed buffer.
Reads the input data, preprocesses, and stores the result in a managed buffer.
|
private |
Verifies that the output is correct and prints it.
Verifies that the inference output is correct.
|
private |
The TensorRT engine used to run the network.
|
private |
|
private |
|
private |