v2026.10.0
All Bundles
Bundle

ONNX Runtime inference library for running pre-trained models. Supports object detection (YOLO), image classification (ResNet), segmentation (DeepLab), pose estimation (OpenPose), face recognition, and Phi-3 text generation. Compile with -lib onnx.

OnnxEngine

API.Onnx as an Engine: a model run in-process. A thin wrapper over Session, which is the whole reason the generic run came first -- without onnx_run there was nothing for an Engine to call, and the eight per-family entry points could not supply one. Use it when calling code should not choose a backend at every call site. Session itself is the better choice when the code is ONNX-specific anyway: GetModelInfo has no equivalent on a remote engine, so it is not on the interface, and this class exposes the Session for that reason.

Implements: Engine

Example

engine := OnnxEngine->New("model.onnx");
if(<>engine->IsOpen()) {
  EndPoint->GetLastError()->PrintLine();
  return;
};

outputs := engine->Run(inputs);
engine->Close();

Operations

Close #

Releases the model. Safe to call more than once.

method : public : Close() ~ Nil

GetSession #

The underlying session, for what the Engine interface deliberately does not carry -- GetModelInfo above all, which has no remote equivalent.

method : public : GetSession() ~ Session

Return

TypeDescription
Sessionthe session

IsOpen #

Whether the model loaded.

method : public : IsOpen() ~ Bool

Return

TypeDescription
Booltrue when a run can proceed

New # constructor

Constructor.

New(model:String)

Parameters

NameTypeDescription
modelStringmodel path

New # constructor

Constructor.

New(model:String, config:Map<String,String>)

Parameters

NameTypeDescription
modelStringmodel path
configMap<String,String>session configuration parameters, e.g. ep

Run #

Runs the model, asking for every output it has.

method : public : Run(inputs:Vector<Tensor>) ~ Vector<Tensor>

Parameters

NameTypeDescription
inputsVector<Tensor>the model's inputs as named tensors

Return

TypeDescription
Vector<Tensor>the outputs, or Nil when the run was refused