TensorRT  7.2.1.6
NVIDIA TensorRT
Looking for a C++ dev who knows TensorRT?
I'm looking for work. Hire me!
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
SampleUffMNIST Class Reference

The SampleUffMNIST class implements the UffMNIST sample. More...

Collaboration diagram for SampleUffMNIST:

Public Member Functions

 SampleUffMNIST (const samplesCommon::UffSampleParams &params)
 
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::ICudaEnginemEngine {nullptr}
 The TensorRT engine used to run the network. More...
 
samplesCommon::UffSampleParams mParams
 
nvinfer1::Dims mInputDims
 
const int kDIGITS {10}
 

Detailed Description

The SampleUffMNIST class implements the UffMNIST sample.

It creates the network using a Uff model

Member Typedef Documentation

◆ SampleUniquePtr

template<typename T >
using SampleUffMNIST::SampleUniquePtr = std::unique_ptr<T, samplesCommon::InferDeleter>
private

Constructor & Destructor Documentation

◆ SampleUffMNIST()

SampleUffMNIST::SampleUffMNIST ( const samplesCommon::UffSampleParams params)
inline

Member Function Documentation

◆ build()

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)

Returns
Returns true if the engine was created successfully and false otherwise
Here is the call graph for this function:

◆ infer()

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.

Here is the call graph for this function:

◆ teardown()

bool SampleUffMNIST::teardown ( )

Used to clean up any state created in the sample class.

Here is the call graph for this function:

◆ constructNetwork()

void SampleUffMNIST::constructNetwork ( SampleUniquePtr< nvuffparser::IUffParser > &  parser,
SampleUniquePtr< nvinfer1::INetworkDefinition > &  network 
)
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.

Parameters
networkPointer to the network that will be populated with the MNIST network
builderPointer to the engine builder
Here is the call graph for this function:
Here is the caller graph for this function:

◆ processInput()

bool SampleUffMNIST::processInput ( const samplesCommon::BufferManager buffers,
const std::string &  inputTensorName,
int  inputFileIdx 
) const
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.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ verifyOutput()

bool SampleUffMNIST::verifyOutput ( const samplesCommon::BufferManager buffers,
const std::string &  outputTensorName,
int  groundTruthDigit 
) const
private

Verifies that the output is correct and prints it.

Verifies that the inference output is correct.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ mEngine

std::shared_ptr<nvinfer1::ICudaEngine> SampleUffMNIST::mEngine {nullptr}
private

The TensorRT engine used to run the network.

◆ mParams

samplesCommon::UffSampleParams SampleUffMNIST::mParams
private

◆ mInputDims

nvinfer1::Dims SampleUffMNIST::mInputDims
private

◆ kDIGITS

const int SampleUffMNIST::kDIGITS {10}
private

The documentation for this class was generated from the following file: