Mila 0.13.48
Deep Neural Network Library
Loading...
Searching...
No Matches
Mila::Dnn::CpuTensorDataTypeTraits Class Referenceexport

CPU-specific traits for abstract tensor data types. More...

Public Types

template<TensorDataType TDataType>
using native_type
 Maps abstract tensor data types to concrete CPU native types.

Static Public Member Functions

template<TensorDataType TDataType>
static consteval bool supports ()
 Validates CPU support for abstract tensor data types.

Detailed Description

CPU-specific traits for abstract tensor data types.

Provides device-specific characteristics and native type mappings for CPU-supported tensor data types, enabling type-safe value initialization and host-specific optimizations.

Member Typedef Documentation

◆ native_type

Initial value:
std::conditional_t<TDataType == TensorDataType::FP32, float,
std::conditional_t<TDataType == TensorDataType::INT8, int8_t,
std::conditional_t<TDataType == TensorDataType::INT16, int16_t,
std::conditional_t<TDataType == TensorDataType::INT32, int32_t,
std::conditional_t<TDataType == TensorDataType::UINT8, uint8_t,
std::conditional_t<TDataType == TensorDataType::UINT16, uint16_t,
std::conditional_t<TDataType == TensorDataType::UINT32, uint32_t,
void>>>>>>>
@ UINT32
32-bit unsigned integer, host-compatible
Definition TensorDataType.ixx:52
@ UINT16
16-bit unsigned integer, host-compatible
Definition TensorDataType.ixx:51
@ INT16
16-bit signed integer, host-compatible
Definition TensorDataType.ixx:48
@ INT32
32-bit signed integer, host-compatible
Definition TensorDataType.ixx:49
@ FP32
32-bit IEEE 754 floating point, host-compatible
Definition TensorDataType.ixx:36
@ UINT8
8-bit unsigned integer
Definition TensorDataType.ixx:50
@ INT8
8-bit signed integer
Definition TensorDataType.ixx:47

Maps abstract tensor data types to concrete CPU native types.

Provides compile-time mapping from abstract TensorDataType enumeration to concrete standard C++ types supported on CPU, enabling type-safe value initialization and host operations.

Template Parameters
TDataTypeAbstract tensor data type to map
Returns
Concrete C++ type corresponding to the abstract type
Note
Only supports types where supports<TDataType>() returns true
All mapped types are standard C++ types compatible with host code

Member Function Documentation

◆ supports()

template<TensorDataType TDataType>
consteval bool Mila::Dnn::CpuTensorDataTypeTraits::supports ( )
inlinestaticconsteval

Validates CPU support for abstract tensor data types.

Determines whether CPU devices and memory resources support the specified abstract tensor data type. CPU typically supports standard C++ types but not device-specific precision formats.

Template Parameters
TDataTypeAbstract tensor data type to validate
Returns
true if CPU supports the data type, false otherwise

The documentation for this class was generated from the following file: