Mila 0.13.48
Deep Neural Network Library
Loading...
Searching...
No Matches
Mila::Dnn::detail Namespace Reference

Functions

std::string formatBytes (size_t bytes)
template<TensorDataType TDataType>
constexpr size_t getStorageSize (size_t logical_size)
 Calculates storage size in bytes for given logical element count.

Function Documentation

◆ formatBytes()

std::string Mila::Dnn::detail::formatBytes ( size_t bytes)
inline

◆ getStorageSize()

template<TensorDataType TDataType>
size_t Mila::Dnn::detail::getStorageSize ( size_t logical_size)
constexpr

Calculates storage size in bytes for given logical element count.

Computes the required storage bytes for a given number of logical elements of the specified tensor data type, handling potential overflow conditions.

Template Parameters
TDataTypeAbstract tensor data type from TensorDataType enumeration
Parameters
logical_sizeNumber of logical elements
Returns
Required storage size in bytes
Exceptions
std::overflow_errorIf calculation would overflow