TensorRT版本与代码写法不对.
具体写法:
# using trt 4.0 G_LOGGER = trt.infer.ConsoleLogger(trt.infer.LogSeverity.INFO) trt_engine = trt.utils.load_engine(G_LOGGER, engine_path) """ ## using trt 5.0 G_LOGGER = trt.Logger(trt.Logger.WARNING) with open(engine_path, "rb") as f, trt.Runtime(G_LOGGER) as runtime: trt_engine = runtime.deserialize_cuda_engine(f.read()) """ self.engine = Engine(trt_engine)