Skip to content

Commit

Permalink
Free TensorRT engine and context
Browse files Browse the repository at this point in the history
  • Loading branch information
Trevor Morris committed Mar 19, 2021
1 parent 45442ed commit 17dbdb5
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 17dbdb5

Please sign in to comment.