From 9bdd784bcc738bb6004d53d83f516b88ff40268c Mon Sep 17 00:00:00 2001
From: Yonghye Kwon <developer.0hye@gmail.com>
Date: Mon, 29 Jan 2024 21:54:06 +0900
Subject: [PATCH] TensorRT FP16 export with `dynamic=True` (#7870)

---
 ultralytics/engine/exporter.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ultralytics/engine/exporter.py b/ultralytics/engine/exporter.py
index 2fd1a143..6d1c3d6a 100644
--- a/ultralytics/engine/exporter.py
+++ b/ultralytics/engine/exporter.py
@@ -227,7 +227,7 @@ class Exporter:
         y = None
         for _ in range(2):
             y = model(im)  # dry runs
-        if self.args.half and (engine or onnx) and self.device.type != "cpu":
+        if self.args.half and onnx and self.device.type != "cpu":
             im, model = im.half(), model.half()  # to FP16
 
         # Filter warnings