mirror of
https://github.com/Findus23/jax-array-info.git
synced 2024-09-07 01:53:49 +02:00
5 lines
183 B
Python
5 lines
183 B
Python
def pretty_byte_size(nbytes: int):
|
|
for unit in ("", "Ki", "Mi", "Gi", "Ti"):
|
|
if abs(nbytes) < 1024.0:
|
|
return f"{nbytes:3.1f} {unit}B"
|
|
nbytes /= 1024.0
|