未验证 提交 55393172 编写于 作者: W wenbin 提交者: GitHub

trt input tensor issue (#45358)

* fix

* optimize
上级 596a9405
...@@ -495,6 +495,11 @@ class TensorRTEngineOp : public framework::OperatorBase { ...@@ -495,6 +495,11 @@ class TensorRTEngineOp : public framework::OperatorBase {
// Bind input tensor to TRT. // Bind input tensor to TRT.
for (const auto &x : runtime_input_names_) { for (const auto &x : runtime_input_names_) {
#if IS_TRT_VERSION_LT(8000)
// trt may remove input tensor if it's unused or used only at compile-time
if (engine->engine()->getBindingIndex(x.c_str()) < 0) continue;
#endif
// convert input and copy to TRT engine's buffer // convert input and copy to TRT engine's buffer
auto &t = auto &t =
inference::analysis::GetFromScope<framework::LoDTensor>(scope, x); inference::analysis::GetFromScope<framework::LoDTensor>(scope, x);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册