espnet2.torch_utils.model_summary.get_human_readable_count
Less than 1 minute
espnet2.torch_utils.model_summary.get_human_readable_count
espnet2.torch_utils.model_summary.get_human_readable_count(number: int) → str
Return human_readable_count
Originated from: https://github.com/PyTorchLightning/pytorch-lightning/blob/master/pytorch_lightning/core/memory.py
Abbreviates an integer number with K, M, B, T for thousands, millions, billions and trillions, respectively. .. rubric:: Examples
>>> get_human_readable_count(123)
'123 '
>>> get_human_readable_count(1234) # (one thousand)
'1 K'
>>> get_human_readable_count(2e6) # (two million)
'2 M'
>>> get_human_readable_count(3e9) # (three billion)
'3 B'
>>> get_human_readable_count(4e12) # (four trillion)
'4 T'
>>> get_human_readable_count(5e15) # (more than trillion)
'5,000 T'
- Parameters:number – a positive integer number
- Returns: A string formatted according to the pattern described above.