Formatting

Formatting utilities for sizes, parameter counts, bytes, and dtypes.

taktiny.utils.format.parse_size(value)[source]

Parse a size expressed as a byte count or with a binary unit suffix.

Parameters:

value (int | str) – Integer byte count, or a string such as "64MB" using KB, MB, GB, or TB suffixes. Suffixes are case-insensitive and decimal magnitudes are accepted.

Return type:

int

Returns:

The size expressed in bytes.

Raises:

ValueError – If the value cannot be interpreted as a non-negative size.

taktiny.utils.format.format_bytes(size)[source]
Return type:

str

Parameters:

size (int)

taktiny.utils.format.format_params(size)[source]
Return type:

str

Parameters:

size (int)

taktiny.utils.format.format_dtype(dtype)[source]
Return type:

str

Parameters:

dtype (Any)