Layers, batch generator, memory
This commit is contained in:
parent
9ab6adce7a
commit
268429fa1a
5 changed files with 277 additions and 0 deletions
8
utils/memory.py
Normal file
8
utils/memory.py
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
def human_size(byte_count: int) -> str:
|
||||
"""Output byte amount in human readable format"""
|
||||
amount = float(byte_count)
|
||||
for unit in ['', 'Ki', 'Mi', 'Gi', 'Ti', 'Pi', 'Ei', 'Zi', 'Yi']:
|
||||
if amount < 1024.0:
|
||||
break
|
||||
amount /= 1024.0
|
||||
return f'{amount:.2f}{unit}B'
|
||||
Loading…
Add table
Add a link
Reference in a new issue