Layers, batch generator, memory

This commit is contained in:
Corentin Risselin 2020-03-31 13:46:01 +09:00
commit 268429fa1a
5 changed files with 277 additions and 0 deletions

8
utils/memory.py Normal file
View 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'