|
nvinfer1::ILayer * | addLSTMCell (SampleUniquePtr< nvinfer1::INetworkDefinition > &network, const LstmIO &inputTensors, nvinfer1::ITensor *sequenceSize, const LstmParams ¶ms, LstmIO &outputTensors) |
|
std::map< std::string, nvinfer1::Weights > | loadWeights (const std::string file) |
| Load requested weights from a formatted file into a map. More...
|
|
void | constructNetwork (SampleUniquePtr< nvinfer1::IBuilder > &builder, SampleUniquePtr< nvinfer1::INetworkDefinition > &network, SampleUniquePtr< nvinfer1::IBuilderConfig > &config) |
| Create full model using the TensorRT network definition API and build the engine. More...
|
|
void | copyEmbeddingToInput (samplesCommon::BufferManager &buffers, const char &c) |
| Looks up the embedding tensor for a given char and copies it to input buffer. More...
|
|
bool | stepOnce (samplesCommon::BufferManager &buffers, SampleUniquePtr< nvinfer1::IExecutionContext > &context, cudaStream_t &stream) |
| Perform one time step of inference with the TensorRT execution context. More...
|
|
void | copyRNNOutputsToInputs (samplesCommon::BufferManager &buffers) |
| Copies Ct/Ht output from the RNN to the Ct-1/Ht-1 input buffers for next time step. More...
|
|
◆ SampleUniquePtr
◆ SampleCharRNNLoop()
◆ addLSTMLayers()
Add inputs to the TensorRT network and configure LSTM layers using network definition API.
Implements SampleCharRNNBase.
◆ addLSTMCell()
◆ build()
bool SampleCharRNNBase::build |
( |
| ) |
|
|
inherited |
Builds the network engine.
Creates the network, configures the builder and creates the network engine.
This function loads weights from a trained TensorFlow model, creates the network using the TensorRT network definition API, and builds a TensorRT engine.
- Returns
- Returns true if the engine was created successfully and false otherwise
◆ infer()
bool SampleCharRNNBase::infer |
( |
| ) |
|
|
inherited |
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.
◆ teardown()
bool SampleCharRNNBase::teardown |
( |
| ) |
|
|
inherited |
Used to clean up any state created in the sample class.
◆ convertRNNWeights()
Converts RNN weights from TensorFlow's format to TensorRT's format.
- Parameters
-
input | Weights that are stored in TensorFlow's format. |
- Returns
- Converted weights in TensorRT's format.
- Note
- TensorFlow weight parameters for BasicLSTMCell are formatted as: Each [WR][icfo] is hiddenSize sequential elements. CellN Row 0: WiT, WcT, WfT, WoT CellN Row 1: WiT, WcT, WfT, WoT ... CellN RowM-1: WiT, WcT, WfT, WoT CellN RowM+0: RiT, RcT, RfT, RoT CellN RowM+1: RiT, RcT, RfT, RoT ... CellNRow2M-1: RiT, RcT, RfT, RoT
TensorRT expects the format to laid out in memory: CellN: Wi, Wc, Wf, Wo, Ri, Rc, Rf, Ro
◆ convertRNNBias()
Converts RNN Biases from TensorFlow's format to TensorRT's format.
- Parameters
-
input | Biases that are stored in TensorFlow's format. |
- Returns
- Converted bias in TensorRT's format.
- Note
- TensorFlow bias parameters for BasicLSTMCell are formatted as: CellN: Bi, Bc, Bf, Bo
TensorRT expects the format to be: CellN: Wi, Wc, Wf, Wo, Ri, Rc, Rf, Ro
Since tensorflow already combines U and W, we double the size and set all of U to zero.
◆ addReshape()
◆ loadWeights()
std::map< std::string, nvinfer1::Weights > SampleCharRNNBase::loadWeights |
( |
const std::string |
file | ) |
|
|
privateinherited |
Load requested weights from a formatted file into a map.
- Parameters
-
file | Path to weights file. File has to be the formatted dump from the dumpTFWts.py script. Otherwise, this function will not work as intended. |
- Returns
- A map containing the extracted weights.
- Note
- Weight V2 files are in a very simple space delimited format. <number of buffers> for each buffer: [name] [type] [shape] <data as binary blob>
Note: type is the integer value of the DataType enum in NvInfer.h.
◆ constructNetwork()
Create full model using the TensorRT network definition API and build the engine.
- Parameters
-
weightMap | Map that contains all the weights required by the model. |
modelStream | The stream within which the engine is serialized once built. |
◆ copyEmbeddingToInput()
Looks up the embedding tensor for a given char and copies it to input buffer.
◆ stepOnce()
Perform one time step of inference with the TensorRT execution context.
◆ copyRNNOutputsToInputs()
Copies Ct/Ht output from the RNN to the Ct-1/Ht-1 input buffers for next time step.
◆ mWeightMap
◆ weightsMemory
◆ mParams
◆ mEngine
The TensorRT engine used to run the network.
The documentation for this class was generated from the following file: