|
Mila 0.13.48
Deep Neural Network Library
|
CPU specialization of TensorOps for initialization operations. More...

Public Types | |
| template<TensorDataType TDataType> | |
| using | host_value_t = std::conditional_t<TensorDataTypeTraits<TDataType>::is_integer_type, int32_t, float> |
Static Public Member Functions | |
| template<TensorDataType TDataType, typename TMemoryResource> requires isValidTensor<TDataType, TMemoryResource> | |
| static void | fill (Tensor< TDataType, TMemoryResource > &tensor, host_value_t< TDataType > host_value, IExecutionContext *exec_context=nullptr) |
| Fill tensor with scalar host value. | |
| template<TensorDataType TDataType, typename TMemoryResource> requires isValidTensor<TDataType, TMemoryResource> | |
| static void | fill (Tensor< TDataType, TMemoryResource > &tensor, std::span< const host_value_t< TDataType > > host_values, IExecutionContext *exec_context=nullptr) |
| Fill tensor with array of host values. | |
CPU specialization of TensorOps for initialization operations.
Provides CPU-specific implementations of tensor fill operations using optimized standard library algorithms for host memory. All operations execute synchronously with no device synchronization overhead.
Key features:
| using Mila::Dnn::Compute::Cpu::FillOps::host_value_t = std::conditional_t<TensorDataTypeTraits<TDataType>::is_integer_type, int32_t, float> |
|
inlinestatic |
Fill tensor with scalar host value.
Broadcasts a single scalar value to all tensor elements using optimized STL fill algorithm.
Implementation:
| TDataType | Abstract tensor data type |
| tensor | Destination CPU tensor to fill |
| host_value | Scalar value in canonical host representation |
| exec_context | Optional execution context (unused for CPU, accepted for API consistency) |

|
inlinestatic |
Fill tensor with array of host values.
Copies host values into CPU tensor with automatic type conversion. Uses optimized STL algorithms for performance.
Implementation:
| TDataType | Abstract tensor data type |
| tensor | Destination CPU tensor to fill |
| host_values | Span of host values in canonical representation |
| exec_context | Optional execution context (unused for CPU, accepted for API consistency) |
