ultralytics 8.1.40 search in Python sets {} for speed (#9450)

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
Glenn Jocher 2024-04-01 00:16:52 +02:00 committed by GitHub
parent 30484d5925
commit ea527507fe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
41 changed files with 97 additions and 93 deletions

View file

@ -237,7 +237,7 @@ def check_version(
result = False
elif op == "!=" and c == v:
result = False
elif op in (">=", "") and not (c >= v): # if no constraint passed assume '>=required'
elif op in {">=", ""} and not (c >= v): # if no constraint passed assume '>=required'
result = False
elif op == "<=" and not (c <= v):
result = False
@ -632,7 +632,7 @@ def check_amp(model):
(bool): Returns True if the AMP functionality works correctly with YOLOv8 model, else False.
"""
device = next(model.parameters()).device # get model device
if device.type in ("cpu", "mps"):
if device.type in {"cpu", "mps"}:
return False # AMP only used on CUDA devices
def amp_allclose(m, im):