Main Content

coder.tensorrtconfig

参数以配置深度学习代码生成nvidiaTensorrt库

描述

coder.tensorrtconfig对象包含nvidia®高性能深度学习推断优化器和运行时库(tensorrt)特定参数。代码根uses those parameters for generating CUDA®深度神经网络的代码。

使用一个coder.tensorrtconfig代码生成的对象,将其分配给深度学习属性coder.gpuconfig您传递给的对象代码根

创建

通过使用coder.DeepLearningConfig目标库设置为'tensorrt'

特性

展开全部

Specify the precision of the inference computations in supported layers. When performing inference in 32-bit floats, use'fp32'。对于半精确,使用'fp16'。对于8位整数,请使用'int8'。默认值是'fp32'

int8精度需要CUDA GPU,最小计算能力为6.1。计算能力为6.2不支持万博1manbetxint8精确。FP16精度需要CUDA GPU,最小计算能力为7.0。使用计算能力property of theGpuConfigobject to set the appropriate compute capability value.

See theDeep Learning Prediction by Using NVIDIA TensorRT使用Tensorrt使用徽标分类网络的8位整数预测的示例。

重新校准期间使用的图像数据集的位置。默认值是''。此选项仅适用于数据类型is set to'int8'

当您选择'int8'选项,Tensorrt™将浮点数据量化为int8。重新校准是通过减少的校准数据集进行的。校准数据必须存在于图像数据位置中DataPath

数字值指定批次数的数量int8校准。该软件使用的产品批处理*NumcalibrationBatches从图像数据集中选择图像的随机子集以执行校准。这批处理*NumcalibrationBatches值不得大于图像数据集中存在的图像数量。此选项仅适用于数据类型is set to'int8'

NVIDIA建议大约500张图像足以校准。有关更多信息,请参阅Tensorrt文档。

A read-only value that specifies the name of the target library.

例子

全部收缩

创建一个入口点功能resnet_predict使用coder.loaddeeplearningnetworkfunction to load theresnet50(深度学习工具箱)系列网络object.

functionout = resnet_predict(in)执着的mynet;如果isempty(mynet) mynet = coder.loadDeepLearningNetwork('resnet50',,,,“ myResnet”);结尾out =预测(mynet,in);

创建一个coder.gpuconfigMEX代码生成的配置对象。

cfg = coder.gpuconfig('Mex');

将目标语言设置为C ++。

CFG。TargetLang ='C ++';

创建一个coder.tensorrtconfig深度学习配置对象。分配给深度学习property of theCFG配置对象。

cfg.deeplearningconfig = coder.deeplearningconfig('tensorrt');

使用-config选项代码根功能通过CFG配置对象。这代码根function must determine the size, class, and complexity of MATLAB®function inputs. Use the-args选项指定输入点功能的输入大小。

代码根-args{一个(224,224,3,'single')}-configCFGresnet_predict;

代码根命令将所有生成的文件放在代码根文件夹。该文件夹包含入口点功能的CUDA代码resnet_predict.cu,,,,header and source files containing the C++ class definitions for the convoluted neural network (CNN), weight, and bias files.

版本历史记录

在R2018B中引入