4
0
mirror of https://github.com/nerfstudio-project/nerfstudio.git synced 2026-11-10 18:17:31 +08:00
This commit is contained in:
Elliot Larez 2026-09-18 18:46:45 -04:00 committed by GitHub
commit 1a319eb967
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -37,6 +37,12 @@ def human_format(num):
Args:
num: number to format
"""
# Prevents math domain error
if num == 0:
return "0.00"
if num < 0:
return f"-{human_format(-num)}"
units = ["", "K", "M", "B", "T", "P"]
k = 1000.0
magnitude = int(floor(log(num, k)))