From 55393172b062aa5c8a55572a54665fe5bcef0957 Mon Sep 17 00:00:00 2001 From: wenbin Date: Wed, 24 Aug 2022 10:41:40 +0800 Subject: [PATCH] trt input tensor issue (#45358) * fix * optimize --- paddle/fluid/operators/tensorrt/tensorrt_engine_op.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/paddle/fluid/operators/tensorrt/tensorrt_engine_op.h b/paddle/fluid/operators/tensorrt/tensorrt_engine_op.h index 3713632511..0f8a3d1206 100644 --- a/paddle/fluid/operators/tensorrt/tensorrt_engine_op.h +++ b/paddle/fluid/operators/tensorrt/tensorrt_engine_op.h @@ -495,6 +495,11 @@ class TensorRTEngineOp : public framework::OperatorBase { // Bind input tensor to TRT. 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 auto &t = inference::analysis::GetFromScope(scope, x); -- GitLab