|
Mila 0.13.48
Deep Neural Network Library
|
High-level initializer helpers (device-dispatching) for tensors. More...
#include <concepts>#include <memory>#include <span>#include <type_traits>#include <cstdint>import Compute.ExecutionContext;import Dnn.TensorDataTypeTraits;import Compute.DeviceType;import Dnn.TensorOps.Base;import Dnn.TensorDataTypeMap;import Dnn.TensorDataType;import Dnn.Tensor;Namespaces | |
| namespace | Mila |
| Mila main API namespace. | |
| namespace | Mila::Dnn |
Functions | |
| template<TensorDataType TDataType, typename TMemoryResource> requires isValidTensor<TDataType, TMemoryResource> | |
| void | Mila::Dnn::fill (Tensor< TDataType, TMemoryResource > &tensor, host_value_t< TDataType > host_value, IExecutionContext *exec_context=nullptr) |
| Fill a tensor with a scalar host value (device-dispatched) with optional ExecutionContext. | |
| template<TensorDataType TDataType, typename TMemoryResource> requires isValidTensor<TDataType, TMemoryResource> | |
| void | Mila::Dnn::fill (Tensor< TDataType, TMemoryResource > &tensor, std::span< const host_value_t< TDataType > > host_values, IExecutionContext *exec_context=nullptr) |
| Copy host values into a tensor with device dispatch and optional ExecutionContext. | |
High-level initializer helpers (device-dispatching) for tensors.
This partition provides the generic, device-agnostic entry points for tensor initialization operations (copying host-provided values into tensors and filling tensors with scalar values). The implementation forwards to the device-specific TensorOps<...> partitions (for example TensorOps<Compute::CpuComputeDeviceTag>::fill(...)).
The host representation for a logical tensor element is defined by TensorDataTypeTraits<TDataType>::host_type and is exposed here via the alias host_value_t<TDataType> so callers and implementations use a single, authoritative host-side type for conversions.
ExecutionContext handling:
Usage:
Preconditions: