From 178245df340d96bd10283fbe843d061ae312aeea Mon Sep 17 00:00:00 2001 From: jetnano Date: Mon, 30 May 2022 18:44:17 +0530 Subject: [PATCH] Fixed FP32 TRT model export --- export.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/export.py b/export.py index c9ad158c5f41..72e170a30bf2 100644 --- a/export.py +++ b/export.py @@ -264,8 +264,8 @@ def export_engine(model, im, file, train, half, simplify, workspace=4, verbose=F for out in outputs: LOGGER.info(f'{prefix}\toutput "{out.name}" with shape {out.shape} and dtype {out.dtype}') - LOGGER.info(f'{prefix} building FP{16 if builder.platform_has_fast_fp16 else 32} engine in {f}') - if builder.platform_has_fast_fp16: + LOGGER.info(f'{prefix} building FP{16 if builder.platform_has_fast_fp16 and half else 32} engine in {f}') + if builder.platform_has_fast_fp16 and half: config.set_flag(trt.BuilderFlag.FP16) with builder.build_engine(network, config) as engine, open(f, 'wb') as t: t.write(engine.serialize())