Class ONNXRuntimeWebBackend

Note

Construct via the Class AniraWeb factory in most cases: aniraWeb.ONNXRuntimeWebBackend(...) rather than new ONNXRuntimeWebBackend(...). The factory threads the WASM instance through for you.

class ONNXRuntimeWebBackend()

ONNX Runtime Web backend implementation. Loads the ORT WASM module directly for synchronous inference in the process() callback, mirroring the native OnnxRuntimeProcessor.

Extends:
  • JSBackendBase

destroy()

Destroy this buffer and free memory

async init()

Async initialization: loads the ORT WASM module, creates an inference session from the model binary stored in anira’s shared WASM memory. Called automatically by the worker handler after processor registration.

Returns:

Promise<void>

process(inputVecPtr, outputVecPtr)

Process buffers. Called by the inference worker when C++ invokes the JS callback. Override in a subclass to implement custom processing.

Arguments:
  • inputVecPtr (number)

  • outputVecPtr (number)