Mila 0.13.48
Deep Neural Network Library
Loading...
Searching...
No Matches
Mila::Dnn::ComponentFactory Class Referenceexport

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)
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)
static SerializationMetadata readComponentMeta (ModelArchive &archive, const std::string &component_name)

Detailed Description

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:

  • Uses ModelArchive scoping API for organized access
  • Abstracts serialization format via SerializationMetadata
  • Provides extensible dispatch infrastructure for component types
Examples
/__w/Mila/Mila/Mila/Src/Dnn/Core/ComponentFactory.ixx.

Member Function Documentation

◆ createFromArchive()

template<DeviceType TDeviceType>
std::shared_ptr< void > Mila::Dnn::ComponentFactory::createFromArchive ( ModelArchive & archive,
const std::string & component_name,
std::shared_ptr< ExecutionContext< TDeviceType > > exec_context )
inlinestatic
Examples
/__w/Mila/Mila/Mila/Src/Dnn/Core/ComponentFactory.ixx.
Here is the call graph for this function:

◆ getComponentName()

std::string Mila::Dnn::ComponentFactory::getComponentName ( const SerializationMetadata & meta)
inlinestatic

Get component name from metadata.

Retrieves the component name field.

Parameters
metaComponent metadata
Returns
Component name
Exceptions
std::runtime_errorif name field is missing
Examples
/__w/Mila/Mila/Mila/Src/Dnn/Core/ComponentFactory.ixx.
Here is the call graph for this function:

◆ getComponentVersion()

int64_t Mila::Dnn::ComponentFactory::getComponentVersion ( const SerializationMetadata & meta)
inlinestatic

Get component version from metadata.

Retrieves the component version field for compatibility checking during deserialization.

Parameters
metaComponent metadata
Returns
Version number
Exceptions
std::runtime_errorif version field is missing
Examples
/__w/Mila/Mila/Mila/Src/Dnn/Core/ComponentFactory.ixx.
Here is the call graph for this function:

◆ getPrecision()

std::string Mila::Dnn::ComponentFactory::getPrecision ( const SerializationMetadata & meta)
inlinestatic

Get optional precision from metadata.

Retrieves the precision field if present, otherwise returns empty string.

Parameters
metaComponent metadata
Returns
Precision string or empty if not specified
Examples
/__w/Mila/Mila/Mila/Src/Dnn/Core/ComponentFactory.ixx.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ parseComponentType()

ComponentType Mila::Dnn::ComponentFactory::parseComponentType ( const SerializationMetadata & meta)
inlinestatic
Examples
/__w/Mila/Mila/Mila/Src/Dnn/Core/ComponentFactory.ixx.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ readComponentMeta()

SerializationMetadata Mila::Dnn::ComponentFactory::readComponentMeta ( ModelArchive & archive,
const std::string & component_name )
inlinestatic
Examples
/__w/Mila/Mila/Mila/Src/Dnn/Core/ComponentFactory.ixx.
Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following file: