一、各项英文缩写词语的基本概念
1、UFF
Universal Framework Format 是一种描述DNN执行图的数据格式,绑定执行图的是输入和输出,UFF有严格规定的语法,支持核心运算的拓展,与完全用户自定义的运算。
包括以下内容:
Ø 具体序列化的格式,采用protobuf格式。
Ø 各种运算的有效定义,以python描述符来表述。
Ø 每个核心运算符执行文档。
2、PLANfile
PLAN文件是运行引擎用于执行网络的序列化数据。包含权重,网络中执行步骤以及用来决定如何绑定输入与输出缓存的网络信息。
3、NEF(NetworkExchange Format)
NEF是用来交换神经网络信息的数据格式。Caffe,UFF与ONNX是各种格式网络交换格式的样例。
4、Parser
TensorRT中设计用来解析NEF格式数据,建立运行引擎的前端。
Execution Context
运行上下文是前向引擎运行时需要的执行环境。
5、Engine
Engine是ICudaEngine的实例,Engine是前向运算示例。
6、NetworkDefinition
网络定义是由运算或者tensor组成的计算图。再TensorRT中是INetworkDefinition类型的示例,
7、CaffeFormat
Caffe格式的网络参数交换格式。
8、ONNX
ONNX格式的网络参数交换格式。
二、TensorRT 类
2 nvinfer1::DimsNCHW
是具有一个索引维度、一个通道维度和两个空间维度的数据的描述符。
nvinfer1::DimsNCHW::DimsNCHW(int batchSize,int channels,int height,int width)
3 IHostMemory
类来处理用户可访问的库分配内存
4 ILayer类
ILayer::getInput(int index) const
parameters:
index the index of input tensor
return:the input tensor
5 IPlugin类
用户自定义层
5.1 IPlugin::configure(const Dims* inputDims,
int nbinputs,
const Dims* outputDims,
int nbOutputs,
int maxBatchSize)
配置层
Parameters
inputDims | The input tensor dimensions. |
nbInputs | The number of inputs. |
outputDims | The output tensor dimensions. |
nbOutputs | The number of outputs. |
maxBatchSize | The maximum batch size. |
5.2 执行层(enqueue)
Parameters
batchSize | The number of inputs in the batch. |
inputs | The memory for the input tensors. |
outputs | The memory for the output tensors. |
workspace | Workspace for execution. |
stream | The stream in which to execute the kernels. |
Returns
0 for success, else non-zero (which will cause engine termination).
5.3
Get the dimension of an output tensor.
Parameters
index | The index of the output tensor. |
inputs | The input tensors. |
nbInputDims | The number of input tensors. |
5.4 IPlugin::getSerializationSize()
find the size of serialization buffer required
returns
the size of serialization buffer
https://docs.nvidia.com/deeplearning/sdk/tensorrt-api/c_api/classnvinfer1_1_1_i_top_k_layer.html