Interface: ModelRunner
April 26, 2025 ยท View on GitHub
@sdeverywhere/runtime / ModelRunner
Interface: ModelRunner
Abstraction that allows for running a generated model on the JS thread or asynchronously (e.g. in a Web Worker), depending on the implementation.
Methods
createOutputs
createOutputs(): Outputs
Create an Outputs instance that is sized to accommodate the output variable
data stored by the model.
Returns
A new Outputs instance.
runModel
runModel(inputs, outputs, options?): Promise<Outputs>
Run the model.
Parameters
| Name | Type | Description |
|---|---|---|
inputs | number[] | InputValue[] | The model input values (must be in the same order as in the spec file). |
outputs | Outputs | The structure into which the model outputs will be stored. |
options? | RunModelOptions | Additional options that influence the model run. |
Returns
Promise<Outputs>
A promise that resolves with the outputs when the model run is complete.
terminate
terminate(): Promise<void>
Terminate the runner by releasing underlying resources (e.g., the worker thread or Wasm module/buffers).
Returns
Promise<void>