The SampleINT8API class implements INT8 inference on classification networks. More...
Public Member Functions | |
SampleINT8API (const SampleINT8APIParams ¶ms) | |
sample::Logger::TestResult | build () |
Builds the network engine. More... | |
sample::Logger::TestResult | infer () |
Runs the TensorRT inference engine for this sample. More... | |
sample::Logger::TestResult | teardown () |
Used to clean up any state created in the sample class. More... | |
Public Attributes | |
SampleINT8APIParams | mParams |
Stores Sample Parameter. More... | |
Private Types | |
template<typename T > | |
using | SampleUniquePtr = std::unique_ptr< T, samplesCommon::InferDeleter > |
Private Member Functions | |
void | getInputOutputNames () |
Populates input and output mapping of the network. More... | |
bool | prepareInput (const samplesCommon::BufferManager &buffers) |
Reads the ppm input image, preprocesses, and stores the result in a managed buffer. More... | |
bool | verifyOutput (const samplesCommon::BufferManager &buffers) const |
Verifies that the output is correct and prints it. More... | |
bool | readPerTensorDynamicRangeValues () |
Populate per tensor dynamic range values. More... | |
bool | setDynamicRange (SampleUniquePtr< nvinfer1::INetworkDefinition > &network) |
Sets custom dynamic range for network tensors. More... | |
void | setLayerPrecision (SampleUniquePtr< nvinfer1::INetworkDefinition > &network) |
Sets computation precision for network layers. More... | |
void | writeNetworkTensorNames (const SampleUniquePtr< nvinfer1::INetworkDefinition > &network) |
Write network tensor names to a file. More... | |
Private Attributes | |
std::shared_ptr< nvinfer1::ICudaEngine > | mEngine {nullptr} |
The TensorRT engine used to run the network. More... | |
std::map< std::string, std::string > | mInOut |
Input and output mapping of the network. 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... | |
std::unordered_map< std::string, float > | mPerTensorDynamicRangeMap |
Mapping from tensor name to max absolute dynamic range values. More... | |
The SampleINT8API class implements INT8 inference on classification networks.
INT8 API usage for setting custom int8 range for each input layer. API showcase how to perform INT8 inference without calibration table
|
private |
|
inline |
sample::Logger::TestResult SampleINT8API::build | ( | ) |
Builds the network engine.
Creates the network, configures the builder and creates the network engine.
This function creates INT8 classification network by parsing the onnx model and builds the engine that will be used to run INT8 inference (mEngine)
sample::Logger::TestResult SampleINT8API::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
sample::Logger::TestResult SampleINT8API::teardown | ( | ) |
Used to clean up any state created in the sample class.
|
private |
Populates input and output mapping of the network.
|
private |
Reads the ppm input image, preprocesses, and stores the result in a managed buffer.
Preprocess inputs and allocate host/device input buffers.
|
private |
Verifies that the output is correct and prints it.
|
private |
Populate per tensor dynamic range values.
Populate per tensor dyanamic range values.
|
private |
Sets custom dynamic range for network tensors.
|
private |
Sets computation precision for network layers.
|
private |
Write network tensor names to a file.
SampleINT8APIParams SampleINT8API::mParams |
Stores Sample Parameter.
|
private |
The TensorRT engine used to run the network.
|
private |
Input and output mapping of the network.
|
private |
The dimensions of the input to the network.
|
private |
The dimensions of the output to the network.
|
private |
Mapping from tensor name to max absolute dynamic range values.