From 043fa9d3bc872b8a2211d2994f0a765d9cf003f7 Mon Sep 17 00:00:00 2001 From: Kevin Chen Date: Tue, 19 Dec 2023 14:29:36 -0800 Subject: [PATCH] Remove usage of TRT deprecated APIs Signed-off-by: Kevin Chen --- .../core/providers/tensorrt/tensorrt_execution_provider.cc | 4 ++-- .../core/providers/tensorrt/tensorrt_execution_provider.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/onnxruntime/core/providers/tensorrt/tensorrt_execution_provider.cc b/onnxruntime/core/providers/tensorrt/tensorrt_execution_provider.cc index f31bea3adfe56..684303a8b6448 100644 --- a/onnxruntime/core/providers/tensorrt/tensorrt_execution_provider.cc +++ b/onnxruntime/core/providers/tensorrt/tensorrt_execution_provider.cc @@ -3171,13 +3171,13 @@ common::Status TensorrtExecutionProvider::Compile(const std::vectorsetFlag(nvinfer1::BuilderFlag::kSPARSE_WEIGHTS); LOGS_DEFAULT(VERBOSE) << "[TensorRT EP] Sparse weights are allowed"; } - +#if NV_TENSORRT_MAJOR == 8 && NV_TENSORRT_MINOR == 5 // enable builder heuristics if (trt_state->build_heuristics_enable) { trt_config->setFlag(nvinfer1::BuilderFlag::kENABLE_TACTIC_HEURISTIC); LOGS_DEFAULT(VERBOSE) << "[TensorRT EP] Builder heuristics are enabled"; } -#if NV_TENSORRT_MAJOR == 8 && NV_TENSORRT_MINOR > 5 || NV_TENSORRT_MAJOR > 8 +#elif NV_TENSORRT_MAJOR == 8 && NV_TENSORRT_MINOR > 5 || NV_TENSORRT_MAJOR > 8 // switch optimizaion level if (trt_state->builder_optimization_level != 3) { trt_config->setBuilderOptimizationLevel(trt_state->builder_optimization_level); diff --git a/onnxruntime/core/providers/tensorrt/tensorrt_execution_provider.h b/onnxruntime/core/providers/tensorrt/tensorrt_execution_provider.h index e746371196c06..7eefdd3cba9e2 100644 --- a/onnxruntime/core/providers/tensorrt/tensorrt_execution_provider.h +++ b/onnxruntime/core/providers/tensorrt/tensorrt_execution_provider.h @@ -88,7 +88,7 @@ struct TensorrtInferDeleter { template void operator()(T* obj) const { if (obj) { - obj->destroy(); + delete obj; } } };