函式 torch_tensorrt::torchscript::embed_engine_in_new_module¶
函式文件¶
-
TORCHTRT_API torch::jit::Module torch_tensorrt::torchscript::embed_engine_in_new_module(const std::string &engine, Device device, const std::vector<std::string> &input_binding_names = std::vector<std::string>(), const std::vector<std::string> &output_binding_names = std::vector<std::string>()¶
獲取先前建立的 TensorRT 引擎,並將其嵌入到 TorchScript 模組中。
接受預構建的序列化 TensorRT 引擎,並將其嵌入到 TorchScript 模組中。將引擎的執行註冊為模組的前向方法。前向方法定義為:forward(Tensor[]) -> Tensor[]
如果未指定繫結名稱,TensorRT 繫結必須具有以下格式的名稱
[符號].[輸入/輸出陣列中的索引] 例如:
[x.0, x.1, x.2] -> [y.0]
- 引數
engine – std::string - 預構建的序列化 TensorRT 引擎
device – CompileSepc::Device - Device 資訊
input_binding_names – std::vector<std::string> - TensorRT 繫結的名稱,按照原始 PyTorch 函式傳入的順序排列(預設為假定下面的約定)
output_binding_names – std::vector<std::string> - TensorRT 繫結的名稱,按照原始 PyTorch 函式返回的順序排列(預設為假定下面的約定)
- 返回值
: 定位到 TensorRT 引擎的新模組