File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -83,6 +83,7 @@ TRTNet::~TRTNet() {
8383 CudaDeviceGuard guard (device_);
8484 context_.reset ();
8585 engine_.reset ();
86+ runtime_.reset ();
8687}
8788
8889static Result<DataType> MapDataType (nvinfer1::DataType dtype) {
@@ -121,10 +122,10 @@ Result<void> TRTNet::Init(const Value& args) {
121122
122123 OUTCOME_TRY (auto plan, model.ReadFile (config.net ));
123124
124- TRTWrapper runtime = nvinfer1::createInferRuntime (TRTLogger::get ());
125- TRT_TRY (!!runtime , " failed to create TRT infer runtime" );
125+ runtime_ = nvinfer1::createInferRuntime (TRTLogger::get ());
126+ TRT_TRY (!!runtime_ , " failed to create TRT infer runtime" );
126127
127- engine_ = runtime ->deserializeCudaEngine (plan.data (), plan.size ());
128+ engine_ = runtime_ ->deserializeCudaEngine (plan.data (), plan.size ());
128129 TRT_TRY (!!engine_, " failed to deserialize TRT CUDA engine" );
129130
130131 TRT_TRY (engine_->getNbOptimizationProfiles () == 1 , " only 1 optimization profile supported" ,
Original file line number Diff line number Diff line change @@ -64,6 +64,7 @@ class TRTNet : public Net {
6464 private:
6565 trt_detail::TRTWrapper<nvinfer1::ICudaEngine> engine_;
6666 trt_detail::TRTWrapper<nvinfer1::IExecutionContext> context_;
67+ trt_detail::TRTWrapper<nvinfer1::IRuntime> runtime_;
6768 std::vector<int > input_ids_;
6869 std::vector<int > output_ids_;
6970 std::vector<std::string> input_names_;
You can’t perform that action at this time.
0 commit comments