Skip to content

Commit

Permalink
Free TensorRT engine and context (apache#7702)
Browse files Browse the repository at this point in the history
  • Loading branch information
Trevor Morris authored and trevor-m committed May 11, 2021
1 parent 119ab67 commit 85bad62
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/runtime/contrib/tensorrt/tensorrt_runtime.cc
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,14 @@ class TensorRTRuntime : public JSONRuntimeBase {
}

#ifdef TVM_GRAPH_RUNTIME_TENSORRT
/*! \brief Destroy engines and contexts. */
~TensorRTRuntime() {
for (auto& it : trt_engine_cache_) {
it.second.context->destroy();
it.second.engine->destroy();
}
}

/*! \brief Run inference using built engine. */
void Run() override {
BuildEngine();
Expand Down

0 comments on commit 85bad62

Please sign in to comment.