|
Mila
Deep Neural Network Library
|
Factory for reconstructing components from serialized archives. More...
Static Public Member Functions | |
| template<DeviceType TDeviceType> | |
| static std::shared_ptr< void > | createFromArchive (ModelArchive &archive, const std::string &component_name, std::shared_ptr< ExecutionContext< TDeviceType > > exec_context) |
| Placeholder: create a component instance from archive. | |
| static std::string | getComponentName (const SerializationMetadata &meta) |
| Get component name from metadata. | |
| static int64_t | getComponentVersion (const SerializationMetadata &meta) |
| Get component version from metadata. | |
| static std::string | getPrecision (const SerializationMetadata &meta) |
| Get optional precision from metadata. | |
| static ComponentType | parseComponentType (const SerializationMetadata &meta) |
| Parse the built-in component kind from metadata. | |
| static SerializationMetadata | readComponentMeta (ModelArchive &archive, const std::string &component_name) |
Factory for reconstructing components from serialized archives.
Provides type-safe helpers that read component metadata using SerializationMetadata abstraction, eliminating JSON exposure in component reconstruction code.
Design Pattern:
|
inlinestatic |
Placeholder: create a component instance from archive.
Full instantiation requires dispatching on both component kind and on-archive precision and is currently unimplemented. This method demonstrates the scoped read pattern and throws on invocation.
Implementation Strategy:
| archive | ModelArchive containing serialized component |
| component_name | Name of component to instantiate |
| exec_context | Execution context for the component |
| std::runtime_error | Always throws - dispatch not yet implemented |
Future usage pattern:
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
Get optional precision from metadata.
Retrieves the precision field if present, otherwise returns empty string.
| meta | Component metadata |
|
inlinestatic |
Parse the built-in component kind from metadata.
Convenience helper that looks up the "type" field in the component metadata and maps it to the typed ComponentType enum.
| meta | Component metadata |
| std::runtime_error | if the metadata does not contain a "type" field |
| std::runtime_error | if the type string is not recognized |