MCPcopy Create free account
hub / github.com/MotrixLab/ViMoGen / format_numel_str

Function format_numel_str

utils.py:9–20  ·  view source on GitHub ↗
(numel: int)

Source from the content-addressed store, hash-verified

7
8
9def format_numel_str(numel: int) -> str:
10 B = 1024**3
11 M = 1024**2
12 K = 1024
13 if numel >= B:
14 return f"{numel / B:.2f} B"
15 elif numel >= M:
16 return f"{numel / M:.2f} M"
17 elif numel >= K:
18 return f"{numel / K:.2f} K"
19 else:
20 return f"{numel}"
21
22def sample_from_range(value: Union[float, int, Sequence, Mapping],
23 device: Optional[torch.device] = None,

Callers 1

_print_bucket_infoMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected