The SampleOnnxMNIST class implements the ONNX MNIST sample. More...
Public Member Functions | |
SampleOnnxMNIST (const samplesCommon::OnnxSampleParams ¶ms) | |
bool | build () |
Function builds the network engine. More... | |
bool | infer () |
Runs the TensorRT inference engine for this sample. More... | |
Private Types | |
template<typename T > | |
using | SampleUniquePtr = std::unique_ptr< T, samplesCommon::InferDeleter > |
Private Member Functions | |
bool | constructNetwork (SampleUniquePtr< nvinfer1::IBuilder > &builder, SampleUniquePtr< nvinfer1::INetworkDefinition > &network, SampleUniquePtr< nvinfer1::IBuilderConfig > &config, SampleUniquePtr< nvonnxparser::IParser > &parser) |
Parses an ONNX model for MNIST and creates a TensorRT network. More... | |
bool | processInput (const samplesCommon::BufferManager &buffers) |
Reads the input and stores the result in a managed buffer. More... | |
bool | verifyOutput (const samplesCommon::BufferManager &buffers) |
Classifies digits and verify result. More... | |
Private Attributes | |
samplesCommon::OnnxSampleParams | mParams |
The parameters for the sample. More... | |
nvinfer1::Dims | mInputDims |
The dimensions of the input to the network. More... | |
nvinfer1::Dims | mOutputDims |
The dimensions of the output to the network. More... | |
int | mNumber {0} |
The number to classify. More... | |
std::shared_ptr< nvinfer1::ICudaEngine > | mEngine |
The TensorRT engine used to run the network. More... | |
The SampleOnnxMNIST class implements the ONNX MNIST sample.
It creates the network using an ONNX model
|
private |
|
inline |
bool SampleOnnxMNIST::build | ( | ) |
Function builds the network engine.
Creates the network, configures the builder and creates the network engine.
This function creates the Onnx MNIST network by parsing the Onnx model and builds the engine that will be used to run MNIST (mEngine)
bool SampleOnnxMNIST::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 and executes the engine.
|
private |
Parses an ONNX model for MNIST and creates a TensorRT network.
Uses a ONNX parser to create the Onnx MNIST Network and marks the output layers.
network | Pointer to the network that will be populated with the Onnx MNIST network |
builder | Pointer to the engine builder |
|
private |
Reads the input and stores the result in a managed buffer.
|
private |
Classifies digits and verify result.
|
private |
The parameters for the sample.
|
private |
The dimensions of the input to the network.
|
private |
The dimensions of the output to the network.
|
private |
The number to classify.
|
private |
The TensorRT engine used to run the network.