核心的C++ API包含在 NvInfer.h 中。

有四个关键的API如下:

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。

1、Bulider API

Builds an engine from a network definition。build与网络相关的engine.

2、Execution API

Context for executing inference using an engine。执行前向计算using engine。

3、Network Definition API

A network definition for input to the builder。网络的定义。

4、Plugin API

 Plugin class for user-implemented layers。用户自己实现的层。

 

命名空间:nvinfer1 (个人理解为是 nvidia inference version1的意思)

命名空间里有很多members,主要涵盖了functions、Enumerations、Enumerator

具体命名空间里的member的意思可以到https://docs.nvidia.com/deeplearning/sdk/tensorrt-api/c_api/namespacemembers.html查阅

 

tensorRT中大量的类以及类的介绍、成员、方法查阅https://docs.nvidia.com/deeplearning/sdk/tensorrt-api/c_api/classes.html

 

下面介绍的是几个重点的类:

IHostMemory: Class to handle library allocated memory that is accessible to the user

与分配内存相关的类库,通过主机内存对象分配的内存由该library拥有,通过调用destroy释放内存。注意该类是不能继承的,否则会影响前向传播的计算。该类有几个成员函数:data (指针,指向数据的首地址)、size( data bytes)、type(数据类型)、destroy。

 

扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄