trtexec --onnx=my_model.onnx --saveEngine=my_model_fp16.trt --minShapes=input:1x3x320x320 --optShapes=input:1x3x640x640 --maxShapes=input:1x3x1280x1280 --fp16
其中
input:1x3x320x320, input是输入tensor的名字
--minShapes 是指输入“input"的最小尺寸
--optShapes 是当前输入的实际大小
--maxShapes 是指输入”input"的最大尺寸
--fp16 推理引擎的精度
官方解释:
--minShapes=spec Build with dynamic shapes using a profile with the min shapes provided
--optShapes=spec Build with dynamic shapes using a profile with the opt shapes provided
--maxShapes=spec Build with dynamic shapes using a profile with the max shapes provided
--minShapesCalib=spec Calibrate with dynamic shapes using a profile with the min shapes provided
--optShapesCalib=spec Calibrate with dynamic shapes using a profile with the opt shapes provided
--maxShapesCalib=spec Calibrate with dynamic shapes using a profile with the max shapes provided
Note: All three of min, opt and max shapes must be supplied.
However, if only opt shapes is supplied then it will be expanded so
that min shapes and max shapes are set to the same values as opt shapes.
Input names can be wrapped with escaped single quotes (ex: \'Input:0\').
Example input shapes spec: input0:1x3x256x256,input1:1x3x128x128
Each input shape is supplied as a key-value pair where key is the input name and
value is the dimensions (including the batch dimension) to be used for that input.
Each key-value pair has the key and value separated using a colon (:).
Multiple input shapes can be provided via comma-separated key-value pairs.
trtexec动态加载自定义插件
trtexec --onnx=my_model.onnx --plugins=build/my_plugin.so --saveEngine=my_model.engine
其中
--plugins 指定我们自定义插件动态库文件名
官方解释
--plugins Plugin library (.so) to load (can be specified multiple times)