【问题标题】:Tensorrt python API set batch sizeTensorrt python API 设置批量大小
【发布时间】:2020-07-23 19:48:58
【问题描述】:

我想在构建 TensorRT 引擎时设置批量大小。

我正在使用 TensorRT 7 和 python API。我正在将 ResNet50 模型转换为 onnx 格式。

【问题讨论】:

    标签: nvidia tensorrt tensorrt-python


    【解决方案1】:

    我无法在 python API 中做到这一点。但是,我使用了 tensorrt 默认附带的trtexec 工具。该工具将 onnx 模型转换为 tensorrt 引擎。

    要转换模型,请使用以下命令:

    trtexec --explicitBatch --onnx=model.onnx --minShapes=input:min_batchxsample_size --maxShapes=input:max_batchxsample_size --optShapes=input:opt_batchxsample_size --saveEngine=model.engine
    

    有关 trtexec 的更多信息,请使用此 GitHub page

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-03-22
      • 2018-03-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多