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

Static Public Member Functions | |
| template<TensorDataType TSrcDataType, typename TSrcMemoryResource, TensorDataType TDstDataType, typename TDstMemoryResource> requires isValidTensor<TSrcDataType, TSrcMemoryResource>&& isValidTensor<TDstDataType, TDstMemoryResource> | |
| static void | copy (const Tensor< TSrcDataType, TSrcMemoryResource > &src, Tensor< TDstDataType, TDstMemoryResource > &dst, IExecutionContext *exec_context=nullptr) |
| Copy tensor data between pre-allocated tensors. | |
| template<TensorDataType TDstDataType, typename TDstMemoryResource> requires isValidTensor<TDstDataType, TDstMemoryResource> | |
| static void | copyFromBlob (const Serialization::ITensorBlob &blob, Tensor< TDstDataType, TDstMemoryResource > &dst, IExecutionContext *exec_context=nullptr) |
Static Private Member Functions | |
| template<TensorDataType TSrcDataType, TensorDataType TDstDataType> | |
| static void | hostConvertImpl (const void *src_data, void *dst_data, size_t count) |
| Private wrapper forwarding to Detail::copyHostToHostWithConversionImpl. | |
| template<TensorDataType TDataType> | |
| static void | hostCopyImpl (const void *src_data, void *dst_data, size_t count) |
| Private wrapper forwarding to Detail::copyHostToHostImpl. | |
CPU specialization of TensorOps for transfer operations.
This specialization provides CPU-specific implementations of tensor transfer operations for the DeviceType::Cpu device type. Handles both same-type and type-conversion transfers with host memory optimization.
Key features:
|
inlinestatic |
Copy tensor data between pre-allocated tensors.
Validates that src and dst have identical shapes, ensures non-zero element count, and dispatches to the appropriate same-type or conversion copy implementation.
| TSrcDataType | Abstract source tensor data type |
| TSrcMemoryResource | Source memory resource type (must be host-accessible) |
| TDstDataType | Abstract destination tensor data type |
| TDstMemoryResource | Destination memory resource type (must be host-accessible) |
| src | Source tensor (pre-allocated) |
| dst | Destination tensor (pre-allocated) |
| exec_context | Optional execution context pointer (ignored for CPU) |
| std::invalid_argument | If tensor shapes do not match |
| std::runtime_error | If underlying data pointers are invalid |

|
inlinestatic |

|
inlinestaticprivate |
Private wrapper forwarding to Detail::copyHostToHostWithConversionImpl.
Thin forwarding wrapper used to encapsulate the internal conversion implementation.
| TSrcDataType | Abstract source tensor data type |
| TDstDataType | Abstract destination tensor data type |
| src_data | Pointer to source memory |
| dst_data | Pointer to destination memory |
| count | Number of logical elements to convert and copy |


|
inlinestaticprivate |
Private wrapper forwarding to Detail::copyHostToHostImpl.
Thin forwarding wrapper used to encapsulate the internal implementation.
| TDataType | Abstract tensor data type |
| src_data | Pointer to source memory |
| dst_data | Pointer to destination memory |
| count | Number of logical elements to copy |

