未验证 提交 995195f9 编写于 作者: Z zlsh80826 提交者: GitHub

[Paddle-TRT] Fix TRT8 cuda error before program exit (#34403)

* trt buildEngineWithConfig is deprecated

* add trt version control
上级 167523e7
...@@ -217,8 +217,17 @@ void TensorRTEngine::FreezeNetwork() { ...@@ -217,8 +217,17 @@ void TensorRTEngine::FreezeNetwork() {
} }
#endif #endif
} }
#if IS_TRT_VERSION_LT(8000)
infer_engine_.reset(infer_builder_->buildEngineWithConfig( infer_engine_.reset(infer_builder_->buildEngineWithConfig(
*network(), *infer_builder_config_)); *network(), *infer_builder_config_));
#else
infer_ptr<nvinfer1::IHostMemory> plan(infer_builder_->buildSerializedNetwork(
*network(), *infer_builder_config_));
infer_ptr<nvinfer1::IRuntime> runtime(createInferRuntime(&logger_));
infer_engine_.reset(
runtime->deserializeCudaEngine(plan->data(), plan->size()));
#endif
PADDLE_ENFORCE_NOT_NULL( PADDLE_ENFORCE_NOT_NULL(
infer_engine_, platform::errors::Fatal( infer_engine_, platform::errors::Fatal(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册