From fc069d670beeb42d9b5ac875ce3ffd6a68b4998b Mon Sep 17 00:00:00 2001 From: Ahzyuan Date: Sat, 1 Mar 2025 13:36:40 +0800 Subject: [PATCH] chore: improve the display of data that is an integer multiple of the unit value. --- torchmeter/unit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/torchmeter/unit.py b/torchmeter/unit.py index fa7756f..5462568 100644 --- a/torchmeter/unit.py +++ b/torchmeter/unit.py @@ -51,7 +51,7 @@ def auto_unit(val:Union[int, FLOAT], unit_system=CountUnit) -> str: if val % unit.value: return f"{val / unit.value:.2f} {unit.name}" else: - return f"{val // unit.value} {unit.name}" + return f"{int(val // unit.value)} {unit.name}" if isinstance(val, int): return str(val) else: