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:
- Registration: Concrete networks register factory functions at startup
- Dispatch: Factory reads metadata to determine network type and precision
- Construction: Invokes appropriate registered factory function
Usage:
"MnistClassifier",
return MnistClassifier::Load(archive, exec_ctx->getDeviceId());
});
archive, exec_context);
static void registerNetwork(const std::string &network_type, NetworkFactoryFunc< TDeviceType, TPrecision > factory)
Definition NetworkFactory.ixx:81
static std::unique_ptr< Network< TDeviceType, TPrecision > > create(ModelArchive &archive, std::shared_ptr< ExecutionContext< TDeviceType > > exec_context)
Definition NetworkFactory.ixx:116
ModelArchive provides high-level helpers for component serialization.
Definition ModelArchive.ixx:47
- Examples
- /__w/Mila/Mila/Mila/Src/Dnn/Core/NetworkFactory.ixx.