|
Mila
Deep Neural Network Library
|
Factory registry for Network deserialization. More...
Public Types | |
| template<DeviceType TDeviceType, TensorDataType TPrecision> | |
| using | NetworkFactoryFunc |
Static Public Member Functions | |
| template<Compute::DeviceType TDeviceType, TensorDataType TPrecision> | |
| static std::unique_ptr< Network< TDeviceType, TPrecision > > | create (ModelArchive &archive, std::shared_ptr< ExecutionContext< TDeviceType > > exec_context) |
| Create a network instance from archive using registered factories. | |
| template<DeviceType TDeviceType, TensorDataType TPrecision> | |
| static void | registerNetwork (const std::string &network_type, NetworkFactoryFunc< TDeviceType, TPrecision > factory) |
Factory registry for Network deserialization.
Provides type-safe network reconstruction from archives using registered factory functions. Each concrete network type registers its own Load() method to enable polymorphic deserialization.
Design Pattern:
Usage:
| using Mila::Dnn::NetworkFactory::NetworkFactoryFunc |
|
inlinestatic |
Create a network instance from archive using registered factories.
Reads network metadata from the archive to determine the network type and dispatches to the appropriate registered factory function for reconstruction.
Metadata Requirements:
| TDeviceType | Device type for the network |
| TPrecision | Precision type for the network |
| archive | Archive containing serialized network |
| exec_context | Execution context for the reconstructed network |
| std::runtime_error | if network metadata is missing or malformed |
| std::runtime_error | if no factory is registered for the network type |
| std::runtime_error | if network reconstruction fails |