@brief: Setup TensorRT engines and context from a serialized engine file @param engine_buffer: a buffer holds the serialized TRT engine
(self, engine_buffer=None)
| 88 | pass |
| 89 | |
| 90 | def _init(self, engine_buffer=None): |
| 91 | ''' |
| 92 | @brief: Setup TensorRT engines and context from a serialized engine file |
| 93 | @param engine_buffer: a buffer holds the serialized TRT engine |
| 94 | ''' |
| 95 | self._runtime = trt.Runtime(logger.trt_logger) |
| 96 | if engine_buffer is not None: |
| 97 | self._engine = self.runtime.deserialize_cuda_engine(engine_buffer) |
| 98 | |
| 99 | self._context = None |
| 100 | if not self.engine.streamable_weights_size: |
| 101 | self.__prepare_execution_contexts() |
| 102 | return self |
| 103 | |
| 104 | def __prepare_execution_contexts(self): |
| 105 | self._context = self.engine.create_execution_context() |
no test coverage detected