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
SampleReformatFreeIO Class Reference

The SampleReformatFreeIO class implements the reformat free I/O sample. More...

Collaboration diagram for SampleReformatFreeIO:

Public Member Functions

 SampleReformatFreeIO (const samplesCommon::CaffeSampleParams &params)
 
bool build (int dataWidth)
 Builds the network engine. More...
 
bool infer (SampleBuffer &inputBuf, SampleBuffer &outputBuf)
 Runs the TensorRT inference engine for this sample. More...
 
bool teardown ()
 Used to clean up any state created in the sample class. More...
 
bool reference ()
 Used to run CPU reference and get result. More...
 
void compareResult ()
 Used to compare the CPU reference with the TRT result. More...
 
bool readDigits (SampleBuffer &buffer, int groundTruthDigit)
 Reads the digit map from the file. More...
 
template<typename T >
bool verifyOutput (SampleBuffer &outputBuf, int groundTruthDigit) const
 Verifies that the output is correct and prints it. More...
 

Public Attributes

samplesCommon::CaffeSampleParams mParams
 
nvinfer1::Dims mInputDims
 The dimensions of the input to the network. More...
 
nvinfer1::Dims mOutputDims
 The dimensions of the output to the network. More...
 
TensorFormat mTensorFormat {TensorFormat::kLINEAR}
 
SampleUniquePtr< nvcaffeparser1::IBinaryProtoBlobmMeanBlob
 
int mDigit
 

Private Types

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

Private Member Functions

void constructNetwork (SampleUniquePtr< nvcaffeparser1::ICaffeParser > &parser, SampleUniquePtr< nvinfer1::INetworkDefinition > &network)
 uses a Caffe parser to create the single layer Network and marks the output layers More...
 

Private Attributes

std::shared_ptr< nvinfer1::ICudaEnginemEngine {nullptr}
 The TensorRT engine used to run the network. More...
 

Detailed Description

The SampleReformatFreeIO class implements the reformat free I/O sample.

It creates the network using a single conv layer

Member Typedef Documentation

◆ SampleUniquePtr

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

Constructor & Destructor Documentation

◆ SampleReformatFreeIO()

SampleReformatFreeIO::SampleReformatFreeIO ( const samplesCommon::CaffeSampleParams params)
inline

Member Function Documentation

◆ build()

bool SampleReformatFreeIO::build ( int  dataWidth)

Builds the network engine.

Creates the network, configures the builder and creates the network engine.

This function creates the single layer network by manual insertion and builds the engine

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

◆ infer()

bool SampleReformatFreeIO::infer ( SampleBuffer inputBuf,
SampleBuffer outputBuf 
)

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 SampleReformatFreeIO::teardown ( )

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

Clean up the libprotobuf files as the parsing is complete

Note
It is not safe to use any other part of the protocol buffers library after ShutdownProtobufLibrary() has been called.
Here is the call graph for this function:

◆ reference()

bool SampleReformatFreeIO::reference ( )

Used to run CPU reference and get result.

◆ compareResult()

void SampleReformatFreeIO::compareResult ( )

Used to compare the CPU reference with the TRT result.

◆ readDigits()

bool SampleReformatFreeIO::readDigits ( SampleBuffer buffer,
int  groundTruthDigit 
)

Reads the digit map from the file.

Reads the digit map from file.

◆ verifyOutput()

template<typename T >
bool SampleReformatFreeIO::verifyOutput ( SampleBuffer outputBuf,
int  groundTruthDigit 
) const

Verifies that the output is correct and prints it.

◆ constructNetwork()

void SampleReformatFreeIO::constructNetwork ( SampleUniquePtr< nvcaffeparser1::ICaffeParser > &  parser,
SampleUniquePtr< nvinfer1::INetworkDefinition > &  network 
)
private

uses a Caffe parser to create the single layer Network and marks the output layers

Uses a caffe parser to create the single layer Network and marks the output layers.

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> SampleReformatFreeIO::mEngine {nullptr}
private

The TensorRT engine used to run the network.

◆ mParams

samplesCommon::CaffeSampleParams SampleReformatFreeIO::mParams

◆ mInputDims

nvinfer1::Dims SampleReformatFreeIO::mInputDims

The dimensions of the input to the network.

◆ mOutputDims

nvinfer1::Dims SampleReformatFreeIO::mOutputDims

The dimensions of the output to the network.

◆ mTensorFormat

TensorFormat SampleReformatFreeIO::mTensorFormat {TensorFormat::kLINEAR}

◆ mMeanBlob

SampleUniquePtr<nvcaffeparser1::IBinaryProtoBlob> SampleReformatFreeIO::mMeanBlob

◆ mDigit

int SampleReformatFreeIO::mDigit

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