Engine constructor. Loads weights, allocates VRAM, and initializes the computation pipeline. This is the most time-consuming operation in the entire system.
void* LiteRtLm_CreateEngine(LiteRtLm_Config config);
| Parameter / Return Value | Detailed Description |
|---|---|
config |
Initialization configuration structure. See details in LiteRtLm_Config. |
Return Value (void*) |
Engine instance handle. This is an Opaque Pointer used for all subsequent API calls. Returns NULL if it fails; please check the console error logs. |
// Execute initialization in a background thread
AsyncTask(ENamedThreads::AnyBackgroundHiPriTask, [this]() {
LiteRtLm_Config MyConfig = GetDefaultConfig();
void* NewEngine = LiteRtLm_CreateEngine(MyConfig);
if (NewEngine) {
this->EngineHandle = NewEngine;
}
});